ThommyH
ThommyH

Reputation: 320

what does Maven -> Update Project... exactly?

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.

Upvotes: 15

Views: 22903

Answers (2)

Scott Izu
Scott Izu

Reputation: 2309

maven update project from eclipse is different because it will generate a Maven Dependencies class path container

mvn eclipse:eclipse generates a Referenced Library Container.

Upvotes: 1

hd1
hd1

Reputation: 34657

Looks like you can use mvn eclipse:clean eclipse:eclipse to regenerate the eclipse project files -- hope that sorts you.

Upvotes: 4

Related Questions