Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not generating schema #23

Closed
lopezm94 opened this issue Jun 19, 2018 · 4 comments
Closed

Not generating schema #23

lopezm94 opened this issue Jun 19, 2018 · 4 comments

Comments

@lopezm94
Copy link

I added the plugin to pom.xml with the following configuration:

<build>
	<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
	<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
	<plugins>
		<plugin>
			<groupId>com.devskiller.jpa2ddl</groupId>
			<artifactId>jpa2ddl-maven-plugin</artifactId>
			<version>0.9.12</version>
			<extensions>true</extensions> <!-- required to run automatically -->
			<configuration>
				<outputPath>${project.basedir}/src/main/resources/db/migration/database.sql</outputPath>
				<packages>
					<package>com.registry.model</package>
				</packages>
				<jpaProperties>
					<property>
						<name>hibernate.dialect</name>
						<value>org.hibernate.dialect.MySQL57Dialect</value>
					</property>
					<property>
						<name>hibernate.default_schema</name>
						<value>prod</value>
					</property>
				</jpaProperties>
				<formatOutput>true</formatOutput>
				<skipSequences>true</skipSequences>
				<delimiter>;</delimiter>
				<action>DROP_AND_CREATE</action> <!--DROP, , CREATE, DROP_AND_CREATE, or UPDATE-->
			</configuration>
		</plugin>
               .
               .
               .
	</plugins>
</build>

After that I ran both ./mvnw com.devskiller.jpa2ddl:jpa2ddl-maven-plugin:0.9.12:generate -X -f pom.xml and ./mvnw com.devskiller.jpa2ddl:jpa2ddl-maven-plugin:0.9.12:generate. It didn't generate the .sql files at the outputPath and the only message appearing in the terminal was:

/home/juan/Projects/registry

I tried running with the intelliJ maven plugin afterwards and got a bit more verbose output:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building registry 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- jpa2ddl-maven-plugin:0.9.12:generate (default-cli) @ registry ---
[INFO] Running schema generation...
[INFO] HHH000412: Hibernate Core {5.2.10.Final}
[INFO] HHH000206: hibernate.properties not found
[INFO] HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
[WARNING] HHH10001002: Using Hibernate built-in connection pool (not for production use!)
[INFO] HHH10001005: using driver [null] at URL [jdbc:h2:mem:jpa2ddl;MODE=MYSQL]
[INFO] HHH10001001: Connection properties: {password=****, user=sa}
[INFO] HHH10001003: Autocommit mode: false
[INFO] HHH000115: Hibernate connection pool size: 20 (min=1)
[INFO] HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect
[INFO] HV000001: Hibernate Validator 5.3.6.Final
[INFO] HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@198536f6'
[INFO] HHH10001008: Cleaning up connection pool [jdbc:h2:mem:jpa2ddl;MODE=MYSQL]
[INFO] Schema saved to /home/juan/Projects/registry/src/main/resources/db/migration/database.sql
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.130 s
[INFO] Finished at: 2018-06-19T12:51:01+02:00
[INFO] Final Memory: 21M/74M
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

Any idea what could be happening?

@jkubrynski
Copy link
Member

Is it still a problem?

@Nomad95
Copy link

Nomad95 commented Jul 23, 2019

@jkubrynski I have the same problem with similar configuration. The build even removes file if it exists in
outputPath

@Nomad95
Copy link

Nomad95 commented Jul 23, 2019

OK. I managed to generate the sql. I've described the plugin in parent (pluginManagement) and child poms and then running clean install on parent.
But embedded h2 db cant generate update scripts because i have JSON type in my Postgresql db ;/

@jkubrynski
Copy link
Member

Primary issue is resolved. The JSON type will be possible after closing #40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants