Having projects A and B in Eclipse, where A has a dependency on B, everything works fine if I try to "Run As/Java Apparication" A from Eclipse. However, when I try to "Run As/Maven Build...", it complains:
The POM for groupname:projectb:jar:0.0.1-SNAPSHOT is missing, no dependency information available
and then later it attempts to download my local dependency from Nexus and that of course fails.
"Resolve workspace artifacts" is enabled in the Maven run configuration. "Workspace resolution" is enabled for all projects. I have already tried:
disabling/enabling everything
Project/Clean everything
Maven/Update Project everything
Installed an external Maven (3.2.1) and repeated all of the above
Using latest Eclipse Kepler with everything updated.
Ideas ?
when you run app it resolves artifact from workspace and it doesn't look into maven local repository, when you invoke maven command from eclipse (maven build) it invokes native mvn or embedded in both case it looks up for dependency in local maven repository and it doesn't find it
so to fix this, you run maven build on project B first with goal mvn clean install and then invoke your maven build on project A that will work
Related
I have a maven project in Eclipse and I added some local jar files to the buildpath. If I do not add any dependency to the pom.xml file I am able to execute maven install. Then, if I add those dependencies to the pom the command maven install continues working as well. Now in this situation if I run maven clean then maven install fails. Why?
I also tried to run Maven -> Update Project but the result is the same. What is the problem?
If you are using non maven dependencies then it will fail to build eg from CLI and in your case in Elipse after cleaning the project as well. In order to make it work you have to installl tha JAR you are using as Maven artifact and the ninclude it in POM dependencies like every other library.
Here you have info on how to install 3rd party JARs to local repo
https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
I got the same problem and resolved by adding the 3rd party in the pom.xml manually
I'm using Eclipse Luna for my project. I've imported a Maven project into it. Right click->import->import existing maven projects. I made mvn clean package install under run configurations. It ran successfully till mid of project, and in the sub modules, it got failed due to some issue in Java file. But whatever the JAR's that have been fetched should be displayed under Maven dependencies under Build path right?
Here is the screenshot
Do I require to make any steps here?
Right click the project and Configure as Maven project
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 have just downloaded a project from github, it has a pom.xml and is missing many dependencies.
I installed m2e Maven integration in Eclipse plugin but now what do I do? It's installed and seems to be working but how do I download the dependencies now?
You checkout the git files to a location different from your Eclipse workspace.
Start Eclipse on a clean workspace and install m2e. (I usually install m2e-wtp to get web projects)
Use File -> Import -> Existing Maven projects.
Point to the pom.xml you want to use in the files checked out above.
Wait while Eclipse downloads half the Internet.
Ready.
Right click on your project, run as -> maven install.
If you can't see these, you either incorrectly installed m2e, or you need to import the project as a maven project.
In that case, delete the project from your workspace (do not check the "delete contents on disk"). Right click in the project explorer and click on import... From that dialog, you can select existing maven projects, where you need to navigate to the highest directory containing a pom.xml file.
Also, if you have maven installed on your computer (not m2e in eclipse), you can open the directory that contains the pom.xml and just type mvn clean install. This will build your project.
If you get a "Build success" message, you'll know that the dependencies have been fetched correctly.
In eclipse, You have to convert your project to a maven project. right click on your project -> maven (or configure) -> convert to maven project (or enable dependencies management).
This should update your dependencies automatically, if it is not the case then right click your project -> maven -> update project (or update dependencies, it depends on the verion of m2e you are using).
It should be enough to build the project. The dependencies should be downloaded during the build.
Pom.xml files are used for Maven projects.
Depending on your Eclipse version, maybe it's not compatible with Maven out of the box. If not, you can install a Maven plugin (like m2e) so that the project can be viewed as a Maven project.
Maven will do the dependency management (if pom.xml file is configured properly)
When you right click on your project->Run As-> Maven install it will download all the dependencies that it does not have already in your local repository.
I have a maven project in Eclipse which has as a dependency another project which I've installed in my local repo with mvn clean install. The dependency in pom:
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mydependency</artifactId>
<version>1.0.0</version>
</dependency>
When I run the project from eclipse in tomcat, Run On Server, it runs fine If I don't have the other project loaded in eclipse(mydependency). If I import mydependency as a maven project in eclipse(I need to for debugging purposes), the project fails on runtime with ClassNotFoundException. It cannot find classes of mydependency project.
What am I doing wrong?
P.S. I've tried the usual, clean, delete, reimport projects, switch workspaces, delete/recreate tomcat in eclipse, even switched eclipse installation...
First solution:
Choose on your project right-click-> Maven -> Disable workspace resolution
Now when you will debug the debugger will find the jar file - not the source. You has to attach source code to the library (choose java project)
Second solution
Run your project on tomcat as war file and debug remotely.
Third solution
Install JD-Eclipse . It is helpful, but sometimes the lines of code are not the same as decompiled.