I am getting really frustrated about this one:
I am using an maven project, using jdbc with eclipselink. mvn install
works as intended. Until I have to change the PW in the persistence.xml. When I do an mvn clean
and afterwards mvn install
the project is broken and the wrong (old) persistence.xml is still in use. In eclipse I have to do maven -> update project
(using m2e addon) and mvn install
works suddenly again.
Now my problem: On the deployment server I am using command line scripting and I found no mvn XYZ
equivalent for the m2e functionality...
Is there some equivalent?
Explicit scenario:
I am developing on my local machine (osx/win7) in an maven project imported in eclipse. I have a JPA Persistence interface which encapsulate the database connection which is realized via eclipselink. I can deploy locally (mvn install
) but after I run mvn clean
and change the password in persistence.xml
mvn install
isn't possible anymore. I just get classDefNotFound Persistor
in the tests because it static initialize the EntityManager which can't connect cause of the new persistence.xml
-- or at least it's my opinion, because the stacktrace is not really helpful. But, after maven -> update project...
in eclipse on the project, mvn install
works again and the new password is taken (tests run!).
When I want to deploy the project on a remote machine (debian, commandline) I can't ´mvn install` the pulled project, cause after I changed the password in persistence.xml for deployment, it's again the wrong persistence.xml or at least some cached used. I hope that make it a bit more clear.
SOLUTION: Make sure persistence.xml is placed in src/main/resources/META-INF and not elsewhere. m2e catches persistence.xml from wrong places (in my case, src/main/java/META-INF). So it was basically just a wrong project structure.
Maven is a popular open-source build tool developed by the Apache Group to build, publish, and deploy several projects at once for better project management. The tool provides allows developers to build and document the lifecycle framework.
You can right-click on your project then Maven > Update Project..., then select Force Update of Snapshots/Releases checkbox then click OK.
To update your code with the most recent version of the code in the repository (which is now Version 1.2, as stored by the other developer), right-click the project or file in your version of Eclipse and select Team→ Update.
Update Maven settings in Eclipse. Right-click your project and select Maven Update Project and update your project.
Looks like you can use mvn eclipse:clean eclipse:eclipse
to regenerate the eclipse project files -- hope that sorts you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With