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.
Looks like you can use mvn eclipse:clean eclipse:eclipse to regenerate the eclipse project files -- hope that sorts you.
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.
Related
I am using the maven embedded eclipse.
Tried :
Deleting the whole m2 repository.
Maven->Update Project.
Run as -> Maven Build
User settings file does not exist(Please don't tell me it has to something with this file)
settings.Xml file
This file is only required if you are using a proxy and i am not
I have every dependency present in pom.xml file of my project but still eclipse is not able to import all these dependencies in the project
I have attached the photo below. Please help me to resolve my issue
mvn dependency:tree
Maven Dependencies
POM.xml file
List of dependency present in pom file of my project
None of the methods mentioned above worked so please help me to solve this issue.
Is there anything related to maven or eclipse version ?
When you execute mvn dependency:tree result shows an error related to "i cannot obtain some jar", it may be due to private reporitory.
If you are working with private repository, make sure you configure access in $HOME/.m2/settings.xml
On another hand I see you are working with snapshots. If you are trying to bind projects you have in your local host machine, ensure you are executing mvn install (or better mvn source:jar install) sucessfully and your system's maven is pointing the same .m2 path that refers Eclipse maven plugin
It seems using the Spring framework Maven repository via HTTP instead of HTTPS causing this issue.
In your pom.xml file replace http://maven.springframework.org with https://maven.springframework.org.
I'm working on an API that depends on a small library I created in my project. In IntelliJ IDEA, it looks like :
PROJECT : myProject
MODULE : mySimpleAPI (maven project + spring boot application)
MODULE : mySmallLib (maven project)
I just added mySmallLib in mySpringAPI's dependencies.
But when I execute the spring-boot:run command, it tried to download the dependency from spring repositories. I tried in offline mode, but it also didn't work. How can I tell to maven that the dependency is already in the project and it doesn't need to download it ?
run mvn clean install on "mySmallLib" project first. This will install the jar in your local maven repo. Then you can perform mvn spring-boot:run on "mySimpleAPI" project.
Seems your code/library is not updating automatically. So you will need to update them manually.
Go to each sub module of your project and open pom.xml. now right click on the file and click on clean install.
Try running your application again, and it should work. Let me know if it doesn't.
I'm working in eclipse on a java / javascript project, we're using maven to manage our project dependencies, I ran into a issue with maven build (clean install) does not install the dependencies that I specified in the POM.xml file, I tried everything I can find on the internet the whole day today, still no luck, I'll be really appreciate if anyone could kindly take a look at, thank you :)
I got a reuse lib project (lib) and a working project (project), the project should be installing the lib during the maven build, So, here's more detail information on what exactly I did:
I ran maven clean on the lib, then ran maven package, the lib-1.0.0-SNAPSHOT.jar file was generated successfully.
then in the working project POM.xml file, I added the dependency declaration.
I right clicked the working project, maven -> update maven project, where I checked the 'force update of snapshots / releases' checkbox, then -> ok
I right clicked the working project, run as -> maven build (with clean install, and also I checked on the 'Update Snapshots' checkbox) -> apply -> run
In the console, I saw the reuse lib was downloading and then downloaded, but it's never got installed (there should be a line says installing reuse lib...), as the result of it, the reuse lib will not be loaded after I ran my working project, it drives me insane -_-!..
Only your maven projects build output can be installed (in the local repository with mvn install, resp. mvn clean install). During the build it will resolve the dependencies (and the transitive dependencies) to be downloaded and packed to your delivery. Those dependencies of your project will implicitly also be "installed" in your local repository since you will see them in your local repository after the download happened - Maven will however not see that as a install in the meaning of install of the default lifecycle.
To install your "reuse lib"-Maven project you will have to run mvn install or mvn clean install on that project's pom rather than on a project which "just uses it as dependency".
I am importing an existing project into my eclipse workspace. I am using Maven 2.2.0, and Eclipse Juno. I could build project successfully using mvn command prompt.
But unable to import the project as eclipse could not build the project.Eclipse is trying to again download from repository. What If we stop eclipse to download the resources again from repository.
I thought I would add Windows--->Preferences-->Maven--Archetype--Add local catalog
I understood that we have ~/.m2/archetype-catalog.xml catalogu file. But to my surprise I cannot find it.
Please suggest me if I am proceeding with correct way or not.
If its correct way, how do I set local archetype.
Please share your thoughts.
Thanks In Advance.
You need to install the mvn plugin and import the mvn project as such. Alternatively, you can eclipsify the mvn project using the goal eclipse:eclipse (with the mvn command line).
In mvn itself you could set the pluginRepo to updatePolicy NEVER temporarily, if you still have issues with Eclipse. I think Eclipse uses the same settings for importing mvn projects.
http://maven.apache.org/settings.html
I personally never was happy with Eclipse's mvn integration. Have you tried IntelliJ?
We recently started using maven for dependency management. Our team uses eclipse as it's IDE. Is there an easy way to get eclipse to refresh the maven dependencies without running mvn eclipse:eclipse?
The dependencies are up to date in the local maven repository, but eclipse doesn't pick up the changes until we use the eclipse:eclipse command. This regenerates a lot of eclipse configuration files.
Have you tried using the m2eclipse plugin? I use it with eclipse and it maintains the eclipse .classpath when I add dependencies. It'll also check for updated dependencies.
You generate the special eclipse files with mvn eclipse:eclipse, but once you've done that, you should let a plugin handle the dependencies while inside eclipse.
That's how we do it at my work place, and it generally works well.