SNAPSHOT Artifacts not visible in eclipse after mvn install - eclipse

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.

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.

Maven Eclipse downloading jar from central repository

When I run mvn eclipse:eclipse against my project the dependencies are downloading from maven central repository http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-site-plugin/3.0/maven-site-plugin-3.0.pom. In the settings.xml file I'm pointing to the local repository c:\maven\repo to download the jar files from.But, When I do the mvn clean install the jars are downloading from the local repository.
Not sure why the with mvn eclipse:eclipse it's always pointing to Maven central repository. Any idea, how I can get the mvn eclipse:eclipse point to local repository and download it from there.

Failed to create Maven Project in eclipse

I added maven plugin in my eclipse .. but still can't create Maven project (doesn't exist in new project ) and i can't find it also in window -> preferences .. can any one tell me what's wrong please !?
May be Maven Integration (m2e) plugin not installed properly(check the eclipse version & try to install suitable plugin).
Alternately you could create maven project via command,
For core java project,
mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
For Webapplication,
mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
Kindly refer the below link:
http://www.mkyong.com/tutorials/maven-tutorials/

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

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.

how to load the dependencies from the pom into classpath of eclipse project?

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