Run maven:install will copy more jars to WEB-INF/lib than i expect - eclipse

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.

Related

Eclipse can't find a class on my 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.

Install child modules' 3rd party dependencies to local maven repo

I have a big maven project which has smaller child modules. I imported the project using m2e eclipse plugin and i got lots of compilation errors in eclipse.
After i built the whole project using mvn clean install some of the errors are gone(because maven plugin is able to find those dependencies in local repository and reference them from there), but the child modules still show lots of compilation error because the child modules' dependencies are missing from local repo. The dependencies are getting copied in a /lib folder inside target folder of child module.

Maven building a project using both Maven Dependencies and Referenced Libraries

Is there a command that will let Maven use the Referenced Libraries when building a project?
See the Dependencies section of Maven / POM Reference:
The cornerstone of the POM is its dependency list. Most every project depends upon others to build and run correctly, and if all Maven does for you is manage this list for you, you have gained a lot. Maven downloads and links the dependencies for you on compilation and other goals that require them. As an added bonus, Maven brings in the dependencies of those dependencies (transitive dependencies), allowing your list to focus solely on the dependencies your project requires.

Maven not updating/downloading dependencies

I'm using Eclipse EE and Apache Wicket.
I have my dependencies written down at pom.xml.
For some reason, maven is not updating even when I try to clean the project and go under Maven > Update Project.
When I go to check the dependencies the jar is there, but it still give me error when I try to run (ClassNotFoundException).
Why is this happening?
Dependency in question:
<dependency>
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>4.0.3</version>
</dependency>
Also already tried to reinstall maven.
Try running mvn eclipse:eclipse to update ur Eclipse.
Also, refresh after completion of the command run.
You shouldn't mix "mvn eclipse:eclipse" and m2eclipse maven eclipse plugin, it will cause the plugin to not operate correctly. If you have done so, you need to remove your .project/.classpath/.settings files and re-import with "import existing maven projects".

SNAPSHOT Artifacts not visible in eclipse after mvn install

from proj-a folder: run mvn install proj-a
from proj-b folder: (proj-b depends on proj-a) run mvn clean eclipse:clean eclipse:eclipse
refresh proj-b in eclipse.
jars that proj-a depends on are in the proj-b classpath, but proj-a-0.0.1-SNAPSHOT.jar is missing. proj-a-0.0.1-SNAPSHOT.jar is in the local repository.
run mvn deploy for proj-a
delete proj-a folder from local repository
run mvn eclipse:eclipse from proj-b folder - all jars are visible.
what can cause this problem? all artifacts should be available right after install operation. mvn does not complains about nothing....
thanks.
For me handling maven projects in eclipse becomes easier using m2eclipse. After you have installed the plugin, right click on your project > Maven > Enable Dependency Management so that it becomes a maven eclipse project. Then, given you have run your mvn install and you can see your SNAPSHOT jar in your local repository, right click on your maven project > Maven > Update Snapshots or in general Maven > Update Dependencies.