Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328560

Summary: Will not execute preprocessor correctly in maven build project, when building a parent with modules
Product: z_Archived Reporter: Gabriele <gabriele>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: CLOSED DUPLICATE QA Contact:
Severity: critical    
Priority: P2 CC: eclipselink.orm-inbox, gabriele, guy.pelletier, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: maven

Description Gabriele CLA 2010-10-25 00:30:13 EDT
Build Identifier: 2.1.0

For some reason if I build with dependencies (i.e. mvn install) the parent project before manually building (mvn install) the persistence module the processor will not go, and the build will fail.
More details (see Pascal's comments on the issue):

http://stackoverflow.com/questions/3458742/why-the-compiler-doesnt-recognize-the-metamodel-attributes/3462375#3462375

I reproduced the problem and here is my analysis. EclipseLink's annotation processor uses the following parameter -Aeclipselink.persistencexml=src/main/resources/META-INF/persistence.xml to find the persistence.xml using a relative path. When running a reactor build, this relative path is wrong (it points on MemoPlatform/src/main/...) and the persistence.xml isn't found. I tried to use an absolute path (using -Aeclipselink.persistencexml=${basedir}/src/main/resources/META-INF/persistence.xml) but then the annotation processor complains about a non relative path.

Reproducible: Always

Steps to Reproduce:
1.Checkout code at https://memorizeasy.googlecode.com/svn/branches/processorBug
2. Run mvn install
It will fail. 
Run mvn install on the persistence module only and then again on the whole project and it will work.
Comment 1 Gabriele CLA 2010-10-31 14:42:37 EDT
The following ended up leaking in my distributed application:
java.lang.Error: Unresolved compilation problems: 
	The import com.mysimpatico.memoplatform.persistence.entities.Meaning_ cannot be resolved
	Meaning_ cannot be resolved to a variable
	Meaning_ cannot be resolved to a variable

	at com.mysimpatico.memoplatform.persistence.Database.<init>(Database.java:6)
	at com.mysimpatico.memoplatform.persistence.MeaningsDatabase.<init>(MeaningsDatabase.java:33)
	at com.mysimpatico.memoplatform.persistence.ContentProducer.<init>(ContentProducer.java:27)
	at com.mysimpatico.memoplatform.persistence.ContentProducer.<clinit>(ContentProducer.java:24)
	at com.mysimpatico.memoplatform.persistence.Installer.checkIfThereIsContent(Installer.java:24)
	at com.mysimpatico.memoplatform.persistence.Installer.restored(Installer.java:20)
	at org.netbeans.core.startup.NbInstaller.loadCode(NbInstaller.java:426)
	at org.netbeans.core.startup.NbInstaller.load(NbInstaller.java:366)
	at org.netbeans.ModuleManager.enable(ModuleManager.java:944)
	at org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:318)
	at org.netbeans.core.startup.ModuleList.trigger(ModuleList.java:254)
	at org.netbeans.core.startup.ModuleSystem.restore(ModuleSystem.java:286)
	at org.netbeans.core.startup.Main.getModuleSystem(Main.java:172)
	at org.netbeans.core.startup.Main.start(Main.java:302)
	at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:114)
	at java.lang.Thread.run(Thread.java:637)
Comment 2 Eric Gwin CLA 2011-05-05 10:16:29 EDT
moving this bug to JPA. Looks like a preprocessor bug, more than a build issue.
Comment 3 Tom Ware CLA 2013-03-27 13:44:58 EDT
triage for 2.5.1
Comment 4 Guy Pelletier CLA 2013-06-17 15:12:57 EDT
Any chance you can try a more recent version of EclipseLink? I believe your issue has been addressed in 2.3 with the fix for bug 345808.
Comment 5 Guy Pelletier CLA 2013-06-18 10:26:46 EDT
Closing as a duplicate of 345808.

*** This bug has been marked as a duplicate of bug 345808 ***
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:27:16 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink