I am trying to create maven project by importing as existing maven project from eclipse workspace project but eclipse is not able to resolve any of the dependencies. Everytime I create the project, update maven dependencies or clean project the dependencies get downloaded but they are not getting referenced from the local maven repository. The build is generated when i run mvn clean install from command line
I am exhausted trying out all the fixes for the issue like enabling indexing, cleaning the project, maven -> update project
My eclipse version is
Eclipse version - Version: 2019-03 (4.11.0)
Build id: 20190314-1200
Java version - java 11 openjdk
Maven preferences are like below
Also this is my maven setting when I run mvn - X
[DEBUG] Message styles: debug info warning error success failure strong mojo project
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /home/ramesh/.m2/settings.xml
[DEBUG] Reading global toolchains from /usr/share/maven/conf/toolchains.xml
[DEBUG] Reading user toolchains from /home/ramesh/.m2/toolchains.xml
[DEBUG] Using local repository at /home/ramesh/.m2/repository
Can someone help me understand the issue and fix ?
Please check below points to get solution from any.
Check if pom.xml is available in your project which you are
importing.
Better to create your project with spring-initializr
from https://start.spring.io/ and add all required dependencies.
At last, you can try to remove your .m2 directory available at home
dir. and then again start eclipse and import project to re-install
all jars.
You should use Maven -> Update and check forced update after import.
Hope you will find solution from any above point.
Related
When i save changes in my java source code with Eclipse i notice in the Progress tab
As i am using Maven which phase or plugin (goal) is being invoked here ?
What happens behind the scene ?
simply it updates maven dependencies based on your pom.xml or resolves Maven dependencies from the Eclipse workspace without installing to the local Maven repository.
visit this site to know about that in detail https://maven.apache.org/ref/3.0.1/maven-core/apidocs/org/apache/maven/project/ProjectBuilder.html
Any change to the source code or pom file of the project signal eclipse to rebuild (if build automatically is enabled). However, maven builds, would check for the required artefacts from the remote repository and download them to local repository (under .maven dir) before running compile phase. Maven plugin can be configured to run offline in which when remote repository will not be queried - making the build execute faster.
I am new to eclipse and programming , so probably a silly question.
According to me build just makes jar file but maven install deploys it to local repo thats m2 .
Also there are two options for build ->maven build and-> maven build..
Could u explain me the explain mw the difference between two.
maven build... lets you specify goal and various other build parameter (build profile, offline, update snapshot, other build parameter etc..)
maven build is a pre-defined goal that eclipse maven plugin wraps under,
You could see the first couple line of output for both of the case
Build - Maven phase - compile and prepare ready to distribute package - eg. JAR
Build... - opens eclipse wizzard where you can customize the build
Install - Maven phase - do the same as with Build and install to local artifact (product of Build phase) to local or remote repository. This will allow to use that project as dependency in other projects.
I cloned one of the open source git repositories and was trying to import it as maven project in eclipse. After I imported everything as a maven project, whole package is getting messed up. See the below error:
How can I fix this issue so that I can build it on my local box? I cloned the same git repository locally on my desktop.
I am using eclipse version:
Eclipse IDE for Java Developers
Version: Luna Service Release 1a (4.4.1)
Build id: 20150109-0600
Steps I have tried already:
I have already tried maven->update project.
I have also tried removing and adding it again.
I tried mvn clean install both on command line and eclipse, they are successful as well.
Can anyone help me with this? If needed, you can also clone it and try importing it to see whether it works for you or not.
The root of your problem is that the build section of the pom.xml for that project specifies:
<sourceDirectory>./src</sourceDirectory>
Eclipse uses the sourceDirectory tag to tell it where the root of the main sources are. If you change that to ./src/main/java, then right-click on the project > Maven > Update Project... and click Ok (I had to do this twice) it will fix the Eclipse classpath so Eclipse can build the project. You can then revert the pom back to the head revision and so long as you don't run Update Project again it should continue to build.
I'm unclear on why that project specifies a non-standard source directory but uses the standard Maven layout, but this should at least get you into a working state within Eclipse.
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 an existing project in maven which is working fine in other remote env which i
dont have any access, I dont know what is the issue in my env, the same project is working
in other remote env.
My Env Details are:-
Java1.7
Tomcat7.x
Eclipse Juno,Build id: 20120614-1722
Plugin Details: M2E - Maven Integration for Eclipse
The below error is coming while importing the project and after selecting pom.xml.
No marketplace entries found to handle maven-compiler-plugin:2.0.2:compile in Eclipse
Go to Window > Preferences > Maven Installations and then deactivate the Embedded and add your own installation.
I would check:
That Eclipse Maven build settings are using a JDK and not a JRE
Check the actual compiler settings in the POM. Maybe the source and target should be explicitly set to 1.7.
It's also worth checking if this runs properly with mvn from the command line to rule out whether it is truly a Maven or IDE issue.