I have a spring maven project created in eclipse...
When I add new dependencies to the pom file, I have to update the project (right click on project->maven->update project)...
when I do this the maven dependencies are automatically removed I have to add them manually (project properties->deployment assembly).
Any ideas on how to solve this ?
Related
In a maven project in eclipse version 2019-12, in "Java Build Path", I dragged "Maven Dependencies" from "Classpath" to "Modulepath".
But after clicked "Maven -> Update Project...", the "Maven Dependencies" is automatically moved under "Classpath" inside "Java Build Path".
Is it a normal behavior in eclipse? Thanks.
Yes, the Maven Dependencies item is always shown under Classpath and moving to Modulepath has no effect.
This is a side effect of how classpath separation is implemented. If and only if there is a module-info.java file:
JARs to be used in src/main/java and src/test/java (not only visible for test sources) are on the modulepath
whereas test scope JARs (to be used in src/test/java) are on the classpath.
For projects without a module-info.java file, all dependencies are added to the classpath.
The project is a maven project.
run as maven install works
mvn install works
I have tried mvn eclipse:eclipse to update project, I can see the jar file in my properties order and export
I have closed and reopened the project
I have deleted and re added the project
I have done a refresh
I have done a maven update project
I have cleaned the project
maven disable maven nature and then configure convert to maven project
It builds just fine from:
The command line:
mvn install
In eclipse run as maven install
It works in intellij idea
For the love of all that is holy...
There was a class of the same name in this project with all lines commented out.
Deleting that source file fixed the problem.
I am trying to import nutch 1.4 into Eclipse. I cloned git repository and then build it using Maven. Then, I imported it in Eclipse as Maven project, but I'm getting the following error:
The archive: /home/devang/.m2/repository/javax/jms/jms/1.1/jms-1.1.jar which is referenced by the classpath, does not exist.
I've seen this behaviour when I had a project already imported in Eclipse, but then deleted the local Maven repository.
To solve this, make m2eclipse re-download the project's dependencies:
Right-click on the project and select Maven > Update Project...
Select Force Update of Snapshots/Releases and hit OK
Eclipse Indigo; m2e 1.1.0; Maven integration for WTP 0.15.3; Maven 3.0.4
My web project has some dependency projects in the same workspace. All projects are installed. When i run maven install, except to see all dependencies in WEB-INF/lib.
When i run maven install plugin or maven war plugin, the WEB-INF/lib will be filled with dependencies, but they are a lot more than i expected, from the "dependency Hierarchy" or "Effective POM" view of the POM file, or from Maven dependencies in classpath view, i can not find the dependencies.
Run Maven->update projects does not help.
So where these dependencies come from or where should i start to debug?
EDIT
Previously my project has a large dependency tree(100+ jars), some of them are not needed, so i decided to remove them. My project depends on a common project, which has some not needed dependencies, i remove them from POM dependencies and run maven install for the whole projects dependency tree, success. then i run maven install on my project, it should not include the jars i removed from the common project, but, unfortunately they are there in WEB-INF/lib.
If you want to know where your dependencies are coming from, run:
mvn dependency:tree
from the command line. This shows how transitive dependencies are pulled in from your declared dependencies.
You can also run:
mvn dependency:analyze
to see if you can remove any unused dependencies to lessen the number of JARs packaged.
Problem solved, I delete the whole project and import from remote, run maven-install, it worked. Still have no idea why it not work before even after i run "maven clean install" on all dependency projects.
Am using eclipse helios with m2eclipse plugin. For a maven project checked out from CVS, how do i tell eclipse to automatically fetch all the jars needed for that project from the dependencies mentioned in the pom.
Thanks for your time
m2eclipse should do this for you (dependencies will be copied to your local repository) and build a valid classpath.
I you have any doubts that the resolved dependencies are outdated try
<select project> -> Context Menu -> Maven -> Update Dependencies
If you want to guarantee that all dependencies (and plugins) are in your local repository you can run the go-offline goal from the Maven Dependency Plugin:
mvn dependency:go-offline
If you want to copy all needed dependencies to one place, use the copy-dependencies goal
mvn dependency:copy-dependencies
The Maven Dependency Plugin will copy all dependencies (including transitive) to the target/dependency folder in this case.
You can run all these commands also from eclipse using:
<select project> -> Context Menu -> Run As -> Maven build... -> <type goals> -> Run