...">

Maven build doesn't work in eclipse; successful from the command line

My maven project in Eclipse Kepler will not build when I call "Run As -> maven install" or "Run As -> Maven build .... clean install".

I am getting the following error:

[ERROR] Failed to execute target in SSLibrary project: Could not resolve dependencies for project com.SSLibrary: jar: 1.1.0-SNAPSHOT: Could not find artifact org.jacorb: jacorb: jar: 2.3.2-redhat-4 in Artifactory -releases (xxx / libs-release-local) → [Help 1]

My pom.xml in eclipse has a red x indicating:

Several annotations found on this line: - Missing artifact org.jacorb: jacorb: jar: 2.3.2-redhat-4 - Missing artifact com.sun: tools: jar: 1.6

However, performing the mvn installation from the command line succeeds. I can also see the org.jacorb.jacorb.jar file, version 2.3.2-redhat-4, in my local repo.

It's almost like Eclipse is played by different rules.

+3


source to share


2 answers


There may be several reasons why Maven build does not work in Eclipse, but works on the command line.

  • Check if you are using the same Maven installation in Eclipse and command line. To do this, check your system path and compare it with the version used in Eclipse, which you can find in the Eclipse settings screen: Maven-> Installations. Are you using the inline version?
  • Check if you are using the same settings.xml file. In Maven, it is located in the $ {MAVEN_HOME} / conf directory. In Eclipse you can specify a different file, also in the Eclipse preferences screen: Maven-> User Preferences
  • Also, check that the local repository on this screen matches the one specified in the settings.xml
  • Make sure you are using the same Java version of Java in Eclipse and Maven.
  • You can try to remove the problematic dependency in your local repository to force a re-download
  • If all else fails and you are using a proxy like Nexus or Archiva, try unzipping the jar file manually to check its integrity (can you see the class files inside?). If the fold is not correct or does not exist, contact your proxy administrator.


Edit: To try and fix the error shown by Eclipse in the pom.xml file after you checked the previous points (in which case the last one is not needed), you can also try this:

  • Right click on your project in the Package / Project Explorer. Select Maven-> Update project. This will update the Eclipse project settings to match your Maven settings. Then run Maven clean + install
+7


source


Try the following:



  • Eclipse IDE> Window> Show View> Maven Repositories> Local Repositories> Rebuild Index
  • Try to clean and update the project within the eclipse.
  • You may also need to remove that particular jar from your m2 repository and force it to maven. I think that sometimes maven "corrupts" the jar.
-1


source







All Articles