m2eclipse will not download any dependencies - java

I was hoping someone might be able to help.
On a brand new windows machine. I've downloaded and installed java jdk before downloading and running the latest version of eclipse (indigo).
From there I have installed the maven integration plugin from the marketplace and created a new maven projected.
The project has a ton of errors mainly to do with missing dependencies or life cycle management.
When I do maven-clean I get the following error message:
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo1.maven.org/maven2): Invalid argument: getsockname to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom -> [Help 1]
I am not behind a firewall and I do not use a proxy. My maven settings.xml is completely default as is my maven project. No classes added, nothing added to the pom.
Can anyone help?
All the best.
p.s here are the errors shown in the pom:
1:
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from/to central (http://repo1.maven.org/maven2): Invalid argument: getsockname to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom
2:
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile)
3:
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile)
4:
Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 from/to central (http://repo1.maven.org/maven2): Invalid argument: getsockname to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.4.3/maven-resources-plugin-2.4.3.pom

Furthermore i recommend to test the configuration etc. first with command line client of Maven (Maven 3.0.X) and not within Eclipse.
The 1./4. shows that you have tried to download some artifact which has failed for whatever reasons. The simple solution for that is to delete the local repository and retry the build. But i recommend to do that first on command line to check if everything is fine.
The 2./3. are indications that the project you are trying to compile does not contain a correct plugin coverage for m2e which can be read in the docs how to solve that.

Problem:
You are missing an artefact in Your maven repository.
How to verify:
If You will browse Your repository You will find out that under .m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.4.1/ artefact will have lastUpdated suffix - maven attempted to download this artefact but failed.
How to solve:
Just add an appropriate artefact into Your maven repository:) There are several ways how to do that but the simplest one will be dropping the folder with the missing artefact. Add since You can build Your project from the CMD just add missing artefact as a dependency into Your project. Build the project from the CMD.

Add dependency is not working through eclipse IDE(JUNO 4.2). Fixed the issue by manually adding dependencies with the below command on command prompt
go to the location where your pom.xml is located
mvn install
once you see status BUILD success from now onwards we can proceed with IDE.

Clearly this is an issue of proxy. Either use VPN or edit procy setting in setting.xml. I searched lot about this error. Finally, I used VPN(Virtual private network ) to disable the proxy and was able to use cetral repository of Maven.
IF you dont want to USE VPN just change Settings.xml host address with proxy address of ur company(which is available in IE->tools->connection->LAN settings->advanced->http. )

This is a proxy problem:
add your proxy config in your setting.xml
remove .m2 folder from your home directory
run any maven command in interactive mode from command line, for example try to create a project
mvn archetype: generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=com.mycompany.app -DartifactId=my-webapp
that's all

I had the same problem. It was because I configured the repository in the settings.xml of my Maven Installation. But this in not used by Eclipse as it comes with its own Maven implementation. You need to configure the repositories (mirror section) in the settings.xml in your profile (.m2/settings.xml).

Related

Create an hermetic Maven build

I'm preparing a workshop where they may be no Internet connection. Because of that, I'd like to provide every dependency/plugin of the project, so attendees can work on it, completely offline.
I've got a basic Maven project with some dependencies and two plugins.
First, I created an alternate local repository:
mvn -Dmaven.repo.local=dependencies dependency:go-offline
Then, I expected the following command to run fine, but it doesn't! And I some mentioned missing plugins are not available in maven central or within the maven distribution:
mvn -o -Dmaven.repo.local=dependencies package
This fail with the following error message:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project XXX: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-profile:jar:2.0.6, org.apache.maven:maven-repository-metadata:jar:2.0.6, org.apache.maven:maven-plugin-registry:jar:2.0.6, classworlds:classworlds:jar:1.1-alpha-2: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.apache.maven:maven-profile:jar:2.0.6 has not been downloaded from it before.
Any idea how to get these missing bits while creating an alternate local repo? Thanks in advance!
Based on this issue in the plugin's Jira this problem is still not resolved.
The best work around so far is to package the project online once, using the custom repository.
mvn -Dmaven.repo.local=dependencies dependency:go-offline
then
mvn -Dmaven.repo.local=dependencies package
and finally
mvn -Dmaven.repo.local=dependencies -o package
If your workshop go farther than deploy, you should check that next goals run fine offline too!
can you declare pluginManagement for every plugin that is used by your packaging? That should enable downloading when dependency:go-offline is called.
(in addition, this will improve stability for your build, since you'll be sure that changing Maven version won't change plugins versions)
Can you confirm this works?
(now, I have ideas to improve this, but won't be available before a few months at least...)
The documentation seems to suggest that you need to run:
mvn dependency:resolve-plugins
Before go-offline
Could you try it?
See: https://people.apache.org/~aramirez/maven-dependency-plugin/go-offline-mojo.html

Maven failing to find jar from Project Repository

I have a jar file which I need to include in my project.
I am using eclipse with Maven
I created the following folder in my project on my computer:
/home/robert/eclipse/BobProjects/BobDiary/in_project_maven_repository/metcarob.com.lib/nachocalendar/0.23
and I placed a file there called:
nachocalendar-0.23.jar
I then added the dependancy to my POM file:
<dependency>
<groupId>metcarob.com.lib</groupId>
<artifactId>nachocalendar</artifactId>
<version>0.23</version>
<scope>compile</scope>
</dependency>
I also added the Repo into my pom file:
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file:///home/robert/eclipse/BobProjects/BobDiary/in_project_maven_repository</url>
</repository>
from what I understand this should work.
When I right click on my project select run as and maven install I get the following error:
[ERROR] Failed to execute goal on project BobDiary: Could not resolve dependencies for project metcarob.com.BobDiary:BobDiary:jar:0.0.1-SNAPSHOT: Failure to find metcarob.com.lib:nachocalendar:jar:0.23 in file:///home/robert/eclipse/BobProjects/BobDiary/in_project_maven_repository was cached in the local repository, resolution will not be reattempted until the update interval of in-project has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project BobDiary: Could not resolve dependencies for project metcarob.com.BobDiary:BobDiary:jar:0.0.1-SNAPSHOT: Failure to find metcarob.com.lib:nachocalendar:jar:0.23 in file:///home/robert/eclipse/BobProjects/BobDiary/
I have followed all the steps I can see for creating an in project repository but it still seems to not be able to find the file.
Does anyone know of a step I am missing?
Thanks
Robert
Update:
I must have made mutiple mistakes. Akber found my first mistake:
I have changed the folder so the group ID is in seperate folders:
(metcarob.com.lib is now metcarob.com.lib) The jar file is now in:
/home/robert/eclipse/BobProjects/BobDiary/in_project_maven_repository/metcarob/com/lib/nachocalendar/0.23
I have verified this because the following directory exists in my machine:
~/.m2/repository/metcarob/com/lib/nachocalendar/0.23
I have moved the file, restarted eclipse and re-ran maven clean and maven install.
The error is now:
[ERROR] Failed to execute goal on project BobDiary: Could not resolve dependencies for project metcarob.com.BobDiary:BobDiary:jar:0.0.1-SNAPSHOT: Failure to find metcarob.com.lib:nachocalendar:jar:0.23 in file:///home/robert/eclipse/BobProjects/BobDiary/in_project_maven_repository was cached in the local repository, resolution will not be reattempted until the update interval of in-project has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project BobDiary: Could not resolve dependencies for project metcarob.com.BobDiary:BobDiary:jar:0.0.1-SNAPSHOT: Failure to find metcarob.com.lib:nachocalendar:jar:0.23 in file:///home/robert/eclipse/BobProjects/BobDiary/in_project_maven_repository was cached in the local repository, resolution will not be reattempted until the update interval of in-project has elapsed or updates are forced
However I also put this project into gitlab and use CI to compile it there with the command mvn install -B
My project now finds the dependency and compiles on the gitlab CI server.
Most likely, one of two problems:
Each part of the group id needs to be its own folder.
The pom.xml of the dependency should exist int the same folder in the repo.
you need to install the jar via maven into your local repo. maven does other things too except for just placing the jar into the respective folder.
please see here
To fix this I had to:
Change the directory structure. I had the group ID of "metcarob.com.lib" and had that as a single directory. I had to change that to 3 directories. metcarob/com/lib
I quit eclipse, deleted the directory ~/.m2 and restarted eclipse. When I did a build it built fine.
Akber's comment was the key but I can't mark a comment as correct to give him credit.
Thanks everyone for the help

maven Failed to read artifact descriptor for raml

I am trying to follow steps from this article and include a build step for my project
https://github.com/mulesoft/raml-for-jax-rs/blob/master/maven-plugin.md
problem is it keeps complaining about not being able to read the artifact, the error line is
[ERROR] Plugin org.raml.plugins:jaxrs-raml-maven-plugin:1.3.4-SNAPSHOT or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.raml.plugins:jaxrs-raml-maven-plugin:jar:1.3.4-SNAPSHOT: Could not find artifact org.raml:jaxrs-to-raml:pom:1.3.4-SNAPSHOT -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin org.raml.plugins:jaxrs-raml-maven-plugin:1.3.4-SNAPSHOT or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.raml.plugins:jaxrs-raml-maven-plugin:jar:1.3.4-SNAPSHOT
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:117)
I can confirm that my local maven repo looks like
~/.m2/repository/org/raml/plugins/jaxrs-raml-maven-plugin/1.3.4-SNAPSHOT/
jaxrs-raml-maven-plugin-1.3.4-SNAPSHOT-javadoc.jar
jaxrs-raml-maven-plugin-1.3.4-SNAPSHOT.pom
jaxrs-raml-maven-plugin-1.3.4-SNAPSHOT-sources.jar
maven-metadata-local.xml
jaxrs-raml-maven-plugin-1.3.4-SNAPSHOT.jar
The error here is that maven cannot find the artifact:
org.raml:jaxrs-to-raml:pom:1.3.4-SNAPSHOT
That is a dependency of:
org.raml.plugins:jaxrs-raml-maven-plugin:jar:1.3.4-SNAPSHOT
Make sure your repository contains the first artifact either by compiling it yourself or by adding the right remote repository
I met with the same problem. It's said in the document:
Clone this repository or download a snapshot.
On the cloned repository, go to the
jaxrs-to-raml/com.mulesoft.jaxrs.raml.generator folder, and execute
mvn install
Once installed, go to the jaxrs-to-raml/jaxrs-raml-maven-plugin
folder and run mvn install.
But it couldn't work with the above problem.
Actually I installed everything in this repo, and that solved my problem.

Maven not able to download dependency

I have started working on a new project using Maven, and I'm unable to have it work properly on eclipse. I have multiples of this error :
ArtifactTransferException: Failure to transfer com.caucho:hessian:jar:3.1.5 from <repository> was cached in the local repository, resolution will not be reattempted until the update interval of Archiva SIVPN Internal has elapsed or updates are forced. Original error: Could not transfer artifact com.caucho:hessian:jar:3.1.5 from/to Archiva SIVPN Internal (<repository>): No response received after 60000 pom.xml /<file> line 2 Maven Dependency Problem
Description Resource Path Location Type
Missing artifact com.caucho:hessian:jar:3.1.5 pom.xml / line 2 Maven Dependency Problem
After doing some research, I found that it was probably either the pom.xml that's wrong, or that I have proxy problems.
I checked that the resource was available on our repository, and that the pom snippet is the same as declared in my code :
<dependency>
<groupId>com.caucho</groupId>
<artifactId>hessian</artifactId>
<version>3.1.5</version>
</dependency>
My proxy works just fine for the trunk of the project, and there is no other proxy I'm aware of.
I thought it was maybe a one-time connection problem, but making a new maven build with -U didn't resolve the problem.
I also found https://stackoverflow.com/questions/6111408/maven2-missing-artifact-but-jars-are-in-place
with several I-don't-know-what-else-to-do solutions, but it didn't work for me...
Since the lead developer is on vacation and I have little experience on mvn, could someone tell me other potential problems that could be responsible for this ?
Thanks in advance for answers :)
Open a command prompt, go to your project directory and run: mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true
The eclipse:eclipse portion will regenerate your project files etc, the last 2 properties are more for convenience but I like downloading the sources and javadoc.
After a failed attempt, maven will leave a small file in your local .m2 repository that will prevent any attempt to re-download the file unless the update interval has elapsed or you force the updates using the maven -U switch described in other answers.
Just delete the folder for that artifact in your local m2 repository and update you project; a new download attempt will trigger.
rm -rf ~/.m2/repository/com/caucho/hessian/3.1.5

Maven Build fail due to missing dependency - Beginner

[ERROR] Failed to execute goal on project CarProject: Could not resolve dependen
cies for project CarProject:CarProject:war:1.0-SNAPSHOT: The following artifacts
could not be resolved: com.googlecode.sslplugin:struts2-ssl-plugin:jar:1.2.1, o
rg.springframework:org.springframework.web.servlet:jar:3.0.5.RELEASE, org.spring
framework:org.springframework.context:jar:3.0.5.RELEASE, javax.transaction:com.s
pringsource.javax.transaction:jar:1.1.0, com.sun:tools:jar:1.6.0: Failure to fin
d com.googlecode.sslplugin:struts2-ssl-plugin:jar:1.2.1 in http://repo1.maven.or
g/maven2 was cached in the local repository, resolution will not be reattempted
until the update interval of central has elapsed or updates are forced -> [Help
1]
Seems like there are more than one dependencies missing, How should i add them ? Is there a place where i could get the dependency or is there a particular standard way of writing it ?
org.springframework.web.servlet = spring-web or spring-webmvc or both depending on what you need from it
org.springframework.context = spring-context
com.springsource.javax.transaction comes from the SpringSource enterprise bundle repository.
struts2-ssl-plugin isn't in central. You'll have to find it in another repository, install it locally, install it on your own repository, like Nexus, or make it a system-scoped dependency.
tools is your JRE. Maven mostly shouldn't be trying to download it. You probably have a bad dependency somewhere.
Download the latest jar file from following location
http://code.google.com/p/struts2-ssl-plugin/downloads/list
Run the following command
Example for struts2-ssl-plugin-1.2.1.jar file
mvn install:install-file -Dfile=E:\Java\Meteors\struts2-ssl-plugin-1.2.1.jar -DgroupId=com.googlecode.sslplugin -DartifactId=struts2-ssl-plugin -Dversion=1.2.1 -Dpackaging=jar

Categories

Resources