You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by kboom <gu...@gmail.com> on 2014/04/05 23:43:16 UTC

Maven JPA metamodel generation in multi-module project

Hello,

I've got a multi-module maven project. One of such modules should generate a
JPA metamodel - I include a snipped in its pom:

<plugin>
				<groupId>org.bsc.maven</groupId>
				<artifactId>maven-processor-plugin</artifactId>
				<version>2.2.4</version>
				<executions>
					<execution>
						<id>generate jpa metamodel sources</id>
						<goals>
							<goal>process</goal>
						</goals>
						<phase>generate-sources</phase>
						<configuration>
						
<outputDirectory>${project.build.directory}/generated-sources/metamodel</outputDirectory>
							<processors>
							
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
							</processors>

							<options>
							
<persistenceXml>src/main/resources/mappings/config/persistence.xml</persistenceXml>
							</options>

						</configuration>
					</execution>
				</executions>
				<dependencies>
					<dependency>
						<groupId>org.hibernate</groupId>
						<artifactId>hibernate-jpamodelgen</artifactId>
						<version>4.3.4.Final</version>
					</dependency>
				</dependencies>
			</plugin>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<version>1.3</version>
				<executions>
					<execution>
						<id>add jpa metamodel sources</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
							
<source>${project.build.directory}/generated-sources/metamodel</source>
							</sources>
						</configuration>
					</execution>
				</executions>
			</plugin>

It works well when triggering build process by mvn clean install - all code
is generated and there is no errors. But when I trigger clean install on the
parent pom (and a aggregate project) code generation seem to be triggered,
but effective only on the local JPA-annotated entities. The entities mapped
by xml mappings (which are defined in other modules) does not contribute to
the output source code (but they were in the first case!). Could someone
tell me please what is wrong?

I run out of options... Thank you!



--
View this message in context: http://maven.40175.n5.nabble.com/Maven-JPA-metamodel-generation-in-multi-module-project-tp5790551.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Maven JPA metamodel generation in multi-module project

Posted by Martin Gainty <mg...@hotmail.com>.
> Date: Sat, 5 Apr 2014 14:43:16 -0700
> From: gurgul.grzegorz@gmail.com
> To: users@maven.apache.org
> Subject: Maven JPA metamodel generation in multi-module project
> 
> Hello,
> 
> I've got a multi-module maven project. One of such modules should generate a
> JPA metamodel - I include a snipped in its pom:
> 
> <plugin>
> <groupId>org.bsc.maven</groupId>
> <artifactId>maven-processor-plugin</artifactId>
> <version>2.2.4</version>
> <executions>
> <execution>
> <id>generate jpa metamodel sources</id>
> <goals>
> <goal>process</goal>
> </goals>
> <phase>generate-sources</phase>
> <configuration>
> 
> <outputDirectory>${project.build.directory}/generated-sources/metamodel</outputDirectory>
> <processors>
> 
> <processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
> </processors>
> 
> <options>
> 
> <persistenceXml>src/main/resources/mappings/config/persistence.xml</persistenceXml>
> </options>
> 
> </configuration>
> </execution>
> </executions>
> <dependencies>
> <dependency>
> <groupId>org.hibernate</groupId>
> <artifactId>hibernate-jpamodelgen</artifactId>
> <version>4.3.4.Final</version>
> </dependency>
> </dependencies>
> </plugin>
> 
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>build-helper-maven-plugin</artifactId>
> <version>1.3</version>
> <executions>
> <execution>
> <id>add jpa metamodel sources</id>
> <phase>generate-sources</phase>
> <goals>
> <goal>add-source</goal>
> </goals>
> <configuration>
> <sources>
> 
> <source>${project.build.directory}/generated-sources/metamodel</source>
> </sources>
> </configuration>
> </execution>
> </executions>
> </plugin>
> 
> It works well when triggering build process by mvn clean install - all code
> is generated and there is no errors. But when I trigger clean install on the
> parent pom (and a aggregate project) code generation seem to be triggered,

MG>
its possible you may not have the correct plugin-repository configured e.g.

<url>https://oss.sonatype.org/content/repositories/snapshots</url>


please display full text of parent pom.xml


please display full text for all modules


since the processor is scanning the codebase at src/main/java and src/test/java for Annotations
we will need to see one example from src/main/java AND src/test/java which display JPA Annotations

 

https://maven-annotation-plugin.googlecode.com/svn/docs/usage.html

MG>

> but effective only on the local JPA-annotated entities. The entities mapped
> by xml mappings (which are defined in other modules) does not contribute to
> the output source code (but they were in the first case!). Could someone
> tell me please what is wrong?
> 
> I run out of options... Thank you!
> 
> 
> 
> --
> View this message in context: http://maven.40175.n5.nabble.com/Maven-JPA-metamodel-generation-in-multi-module-project-tp5790551.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>