How to Get Maven to Fail on Deploy when warned about "CHECKSUM FAILED" - maven-2

On maven deploy maven attempts to retrieve the previous metadata form the repository. If it is corrupt maven issues a warning, calls the build successful but doesn't upload my artifact. This was caused by corruption in my repository and I'd like to either avoid it in future or make it more obvious with a build failure.
Can I alter my pom to change this warning into an error so I'll see it quickly?
[INFO] Retrieving previous metadata from daeng-snap
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'ea12f35b3bc6d88f7336891562d91985b412bf1a'; remote = '51a6f4a52ad8f3926dbb28807317a90b9cd62ec1' - RETRYING
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'ea12f35b3bc6d88f7336891562d91985b412bf1a'; remote = '51a6f4a52ad8f3926dbb28807317a90b9cd62ec1' - IGNORING
[INFO] Uploading repository metadata for: 'artifact com.myco.xyz'
[INFO] Uploading project information for xyz 5.0.2-20091224.163241-12
[INFO] Retrieving previous metadata from snaphots
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '00766e1a0130c3499442c06b52523960c5860f3c'; remote = 'c9bcfc92b3145688aa8ec77dcac244c70be4d0b4' - RETRYING
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '00766e1a0130c3499442c06b52523960c5860f3c'; remote = 'c9bcfc92b3145688aa8ec77dcac244c70be4d0b4' - IGNORING
[INFO] Uploading repository metadata for: 'snapshot com.myco.xyz:xyz:5.0.2-SNAPSHOT'

You can fail your build due to a bad checksum. Simply configure your repository element - preferably in your settings.xml or inside your repository manager such as nexus.
Example:
<repository>
<id>central</id>
<name>My Central Repository</name>
<url>http://repo1.maven.org/maven2</url>
<releases>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</repository>
More info here: http://www.sonatype.com/books/maven-book/reference/appendix-settings-sect-settings-repository.html

Related

Connection timing out while connecting to Maven repository

I am trying to build my project in my local system using the below command
mvn clean install -Dmaven.test.skip=true
It fails with the below error. It is failing to connect to repo.maven.apache.org.
I pinged to the server repo.maven.apache.org, I can see the response back.
I am using maven 3 version and connecting to maven 2 repo (repo.maven.apache.org).
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building web-order-avpn 1702.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: **https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom**
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.778 s
[INFO] Finished at: 2017-01-19T21:21:10-06:00
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its
dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5:
Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central
(https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.56.215] failed: Connection timed out: connect -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Would be great if some one can suggest on what is wrong with my system?
I had this same issue and just like the comments suggested it was the maven proxy. Setup in \conf\settings.xml
http://maven.apache.org/guides/mini/guide-proxies.html

Maven build issue due to codehause termination

As codehause services are terminated, getting below build error. How do I change the codehause repository to another repository or is there any another way to handle this issue.
*** CHECKSUM FAILED - Checksum failed on download: local = '7226cd6d25
06216c083eb2a25d71db156ed7e3f3'; remote = - RETRYING
Downloading: repository.codehaus.org/org/apache/geronimo/genesis/config/c
onfig/1.1/config-1.1.pom
318b downloaded
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '7226cd6d25
06216c083eb2a25d71db156ed7e3f3'; remote = - IGNORING
[ERROR] BUILD ERROR
I have below dependency in my project,
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.1</version>
</dependency>

What could be causing 'error transferring file' in maven?

I have installed maven 2.2.1 on my debian machine and getting the following error
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retrieved from repository: central due to an error: Error transferring file: repository.exoplatform.org
What I have been able to find relating to this problem is its typically caused by not having proxy settings correctly configured or a firewall blocking traffic, but I dont have either on this machine. Also, I have the same settings file on my windows machine and it works fine.
Any suggestions would be greatly appreciated as I am stumped.
exo#melb-web:~/test$ mvn -v
Apache Maven 2.2.1 (r801777; 2009-08-07 05:16:01+1000)
Java version: 1.5.0_22
Java home: /usr/local/bin/jdk1.5.0_22/jre
Default locale: en_AU, platform encoding: UTF-8
OS name: "linux" version: "2.6.22-3-amd64" arch: "i386" Family: "unix"
exo#melb-web:~/test$ mvn archetype:generate
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retrieved from repository: central due to an error: Error transferring file: repository.exoplatform.org
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Jun 30 10:18:33 EST 2010
[INFO] Final Memory: 2M/136M
[INFO] ------------------------------------------------------------------------
* EDIT *
I tried removing the settings.xml and generating a new maven project. I got the following
exo#melb-web:~/test$ mvn archetype:generate
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retrieved from repository: central due to an error: Error transferring file: repo1.maven.org
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Jun 30 11:40:26 EST 2010
[INFO] Final Memory: 1M/136M
[INFO] ------------------------------------------------------------------------
I think this rules out it being a problem with the settings.xml or a pom. Is there a way to get more information about why maven cant connect to the repository?
I've tried the same commands and get the same error message, so I've run using the debug flag. This gives a different root exception depending on the proxy settings etc.
Try running the same in case you get better verbose output.
mvn -X archetype:generate
Case 1:
Machine not connected to network (Cable disabled) gives a debug message
[DEBUG] Exception
org.apache.maven.wagon.TransferFailedException: Error transferring file
...
Caused by: java.net.UnknownHostException: repo1.maven.org
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
[INFO] Repository 'central' will be blacklisted
Case 2:
Machine connected with incorrect proxy gives the debug message
[DEBUG] Exception
org.apache.maven.wagon.TransferFailedException: Error transferring file
...
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
[INFO] Repository 'central' will be blacklisted
Here error could be 403, connection reset or Authorization or access forbidden error
Case 3:
Machine with direct connection to internet
[DEBUG] Trying repository central
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-archet
ype-plugin/2.0-alpha-5/maven-archetype-plugin-2.0-alpha-5.jar
[DEBUG] Artifact resolved
[INFO] ------------------------------------------------------------------------
and so on till it works.
Just to close the loop on this one - it turned out to be an issue with the libraries debian had available for java uses to resolve hostnames. The fix is to apply a new libdns for java as described here http://www.ehow.com/how_4747553_fix-unknownhostexception-java-applications-ubuntu.html. Once I did this I am able to run mvn with jdk5 and jdk6.
I would guess it has something to do with the repository settings in the pom, a parent pom or in your ~/.m2/settings.xml file. Its also possible that the repo at exoplatform is misconfigured.
With no repositories set the archetype plugin would come from repo1.maven.org
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/
I had the same problem. In my case it was actually a leftover settings.xml file from a prior job. I backed up and removed ~/.m2/settings.xml and the build went through just fine.
Update to maven 3.0.4 or up, if possible.
I've studied the maven source code: There is a bootstrap problem inside maven 2.2.1. The proxy is looked up as HTTPS when accessing HTTPS servers, but you only can have one proxy as active. There is no fallback to HTTP proxy. In maven 3.0.4 this issue seems to be solved.
The quick "solution" is to give fully qualified plugin name in the command :
mvn org.mortbay.jetty:maven-jetty-plugin:run
Don't forget to turn off your VPN especially for Chinese people. It's an SSL handshake issue.

I am unable to run maven2

I am not able to run Maven 2.1. I get following Error while running:
****************************************************************
naresh#HYRDSRVIHUB01:~/.m2> mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retrieved from repository: central due to an error: Error transferring file: Connection refused
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Thu Jul 22 17:59:02 IST 2010
[INFO] Final Memory: 3M/240M
[INFO] ------------------------------------------------------------------------
******************************************************************
Help me to get rid of it.
As already pointed out, you are running Maven. However, depending on what you're asking Maven to do, Maven might have to download libraries from a remote repository: plugins, dependencies, etc that are then stored in your local repository and downloading libraries from a remote repository requires a connection.
If you start using Maven with an empty local repository, this is something you can't avoid and you'll have to let Maven download what it needs first.
Sure, you can run Maven offline (using the -o or --offline command line optionsbut this will work only if you already have the required stuff in your local repository.
Oh, and by the way, I'm not sure it's really wise to create a project under your ~/.m2 directory. You should run archetype:create from another location, e.g. ~/Projects.
Your running maven, the issue is either with your connection it seems to be getting rejected by the maven repo:
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retrieved from repository: central due to an error: Error transferring file: Connection refused

maven and lift using scala 2.8 : lift-mapper missing?

Newbie question since I'm not up to speed using
maven at all.
I'm trying to use scala + lift using scala 2.8, environment
is a win7 box if that matters.
I create a basic project using:
mvn archetype:generate -U -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic -DarchetypeVersion=2.0-scala280-SNAPSHOT -DarchetypeRepository=http://scala-tools.org/repo-snapshots -DremoteRepositories=http://scala-tools.org/repo-snapshots -DgroupId=com.liftworkshop
-DartifactId=todo -Dversion=1.0-SNAPSHOT
So far so good, but then, I try to cd into my new project
and do:
mvn jetty:run
I after quite a few downloads end up with a error like below:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) net.liftweb:lift-mapper:jar:2.0-scala280-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=net.liftweb -DartifactId=lift-mapper -D
version=2.0-scala280-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=net.liftweb -DartifactId=lift-mapper -Dve
rsion=2.0-scala280-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -Dr
epositoryId=[id]
Path to dependency:
1) com.liftworkshop:todo:war:1.0-SNAPSHOT
2) net.liftweb:lift-mapper:jar:2.0-scala280-SNAPSHOT
----------
1 required artifact is missing.
for artifact:
com.liftworkshop:todo:war:1.0-SNAPSHOT
from the specified remote repositories:
scala-tools.snapshots (http://scala-tools.org/repo-snapshots),
scala-tools.releases (http://scala-tools.org/repo-releases),
central (http://repo1.maven.org/maven2)
Any ideas?
I created the same project using the mvn archetype:generate command you provided but I couldn't reproduce your problem. The lift-mapper-2.0-scala280-SNAPSHOT.jar artifact is definitely in the scala snapshots repository and Maven downloaded it:
...
1619K downloaded (lift-mapper-2.0-scala280-SNAPSHOT.jar)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '0c857e2c5de9d5cabb7c972e519528606f19697b'; remote = 'a258cf7d7a49a8d7163d499da06a4d1e231a78e0' - RETRYING
Downloading: http://scala-tools.org/repo-snapshots/net/liftweb/lift-mapper/2.0-scala280-SNAPSHOT/lift-mapper-2.0-scala280-SNAPSHOT.jar
1619K downloaded (lift-mapper-2.0-scala280-SNAPSHOT.jar)
As you can see, Maven had to retry the download because of a failed CHECKSUM check but it worked.
Just try again.