How to deploy an artifact into Amazon S3 with Maven? - maven

I'm trying to follow these tutorials (1,2) to achieve the mentioned goal. But I'm still getting this error from Maven:
INFO] Installing /home/valter/temp-workspace/document-engine/target/application-1.0.0.CI-SNAPSHOT.jar to /home/valter/.m2/repository/com/company-solutions/application/1.0.0.CI-SNAPSHOT/application-1.0.0.CI-SNAPSHOT.jar
[INFO] Installing /home/valter/temp-workspace/document-engine/pom.xml to /home/valter/.m2/repository/com/company-solutions/application/1.0.0.CI-SNAPSHOT/application-1.0.0.CI-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) # application ---
Downloading: s3://myrepo.company.solutions/snapshot/com/company-solutions/application/1.0.0.CI-SNAPSHOT/maven-metadata.xml
[WARNING] s3://myrepo.company.solutions/snapshot - Connection refused
[WARNING] Could not transfer metadata com.company-solutions:application:1.0.0.CI-SNAPSHOT/maven-metadata.xml from/to s3.snapshot (s3://myrepo.company.solutions/snapshot): Could not connect to repository
[INFO] Logged off - myrepo.company.solutions
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:31 min
[INFO] Finished at: 2015-11-16T18:36:26+01:00
[INFO] Final Memory: 181M/1289M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project application: Failed to retrieve remote metadata com.company-solutions:application:1.0.0.CI-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.company-solutions:application:1.0.0.CI-SNAPSHOT/maven-metadata.xml from/to s3.snapshot (s3://myrepo.company.solutions/snapshot): Could not connect to repository: Status Code: 400, AWS Service: Amazon S3, AWS Request ID: 709B60A05E8E7062, AWS Error Code: InvalidRequest, AWS Error Message: The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256. -> [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/MojoExecutionException
These are my local files, ~.m2/settings.xml (with fictious values, of course):
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>s3.site</id>
<username>access_key</username>
<password>private_key</password>
</server>
<server>
<id>s3.release</id>
<username>access_key</username>
<password>private_key</password>
</server>
<server>
<id>s3.snapshot</id>
<username>access_key</username>
<password>private_key</password>
</server>
</servers>
</settings>
And my pom.xml:
<project>
<build>
<extensions>
<extension>
<groupId>org.kuali.maven.wagons</groupId>
<artifactId>maven-s3-wagon</artifactId>
<version>1.2.1</version>
</extension>
</extensions>
...
</build>
<distributionManagement>
<site>
<id>s3.site</id>
<url>s3://myrepo.company.solutions/site</url>
</site>
<repository>
<id>s3.release</id>
<url>s3://myrepo.company.solutions/release</url>
</repository>
<snapshotRepository>
<id>s3.snapshot</id>
<url>s3://myrepo.company.solutions/snapshot</url>
</snapshotRepository>
</distributionManagement>
...
</project>
I'm using Maven 3.3.3.
EDIT
This is my policy simulator result:

Just to let you guys know what happened.
The problem was the region of my bucket was Frankfurt, which requires the newest version of authentication from Amazon AWS, version 4. As far as I can tell, the plugin aws-maven doesn't support this new version right now. So the solutions was to move my bucket to another region which support the older version of schemes, like US Standard. And everything seems to work fine now!

Related

Push docker image to Nexus

Hello I have Jenkins and Nexus on the same server. When Jenkins build project correctly, i want push image to Nexus 3, but every time i have the same problem (log below).
Configuration:
pom.xml
<nexus.url>http://adress/#browse/browse/components:docker-image</nexus.url>
<distributionManagement>
<snapshotRepository>
<id>nexus</id>
<url>${nexus.url}</url>
</snapshotRepository>
</distributionManagement>
...
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.4</version>
<extensions>true</extensions>
<configuration>
<serverId>nexus</serverId>
<nexusUrl>${nexus.url}</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
And i have file settings.xml:
<servers>
<server>
<id>nexus</id>
<username>login</username>
<password>password</password>
</server>
</servers>
Then i try "mvn clean deploy" and result is:
[INFO] Deploying remotely...
[INFO] Bulk deploying locally gathered artifacts from directory:
[INFO] * Bulk deploying locally gathered snapshot artifacts to URL http://adress/repository/image-docker/
Downloading: http://adress/repository/image-docker/someProject/0.1-SNAPSHOT/maven-metadata.xml
Uploading: http://adress/repository/image-docker/someProject/0.1-SNAPSHOT/someProject-0.1-20161213.093022-1.jar
Uploading: http://adress/repository/image-docker/someProject//0.1-SNAPSHOT/someProject-0.1-20161213.093022-1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:58 min
[INFO] Finished at: 2016-12-13T10:30:35+01:00
[INFO] Final Memory: 75M/748M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.4:deploy (injected-nexus-deploy) on project someProject:
Failed to deploy artifacts: Could not transfer artifact someProject:jar:0.1-20161213.093022-1 from/to nexus (http://adress/repository/image-docker/):
Failed to transfer file: http://adress/repository/image-docker/someProject/someProject/0.1-SNAPSHOT/someProject-0.1-20161213.093022-1.jar.
Return code is: 502, ReasonPhrase: Bad Gateway. -> [Help 1]
Every time is the same problem with 502 - Bad Gateway.
Do you have some proposal?
Unfortunately this will not work for a few reasons.
The URL you are using as a Nexus url is wrong, that URL is the browser URL. You need to use something more akin to https://nexusurl:portofdockerhostedrepo/repository/nameofdockerhostedrepo. You can get more information on setting up and pushing Docker images here: https://books.sonatype.com/nexus-book/reference3/docker.html#docker-push
Unless I'm completely wrong, mvn deploy is primarily for deploying maven artifacts into Maven repositories. I don't think this will work if you are attempting to deploy a Docker image. You might take a look at using something like this: https://github.com/spotify/docker-maven-plugin
Hope this helps.

Nexus not downloading artifacts through Hudson

I'm trying to integrate Hudson with Nexus.
As I build a project without using Nexus, its build is successful.
When I try building it with Nexus, I get the following build errors:
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 12:22:22-0300)
Maven home: /var/lib/hudson/maven/slavebundle/bundled-maven
Java version: 1.7.0_91, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91.x86_64/jre
Default locale: pt_BR, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-220.el6.x86_64", arch: "amd64", family: "unix"
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/var/lib/hudson/maven/slavebundle/lib/maven3-eventspy-runtime.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/var/lib/hudson/maven/slavebundle/bundled-maven/lib/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[DEBUG] Connected to remote
[INFO] o.h.m.e.h.SettingsBuildingRequestHandler - Using settings document ID: ff56412a-102c-4256-80bf-f234990c91ba
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Project
[INFO] ------------------------------------------------------------------------
Downloading: http://localhost:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[WARNING] The POM for org.apache.maven.plugins:maven-clean-plugin:jar:2.5 is missing, no dependency information available
Downloading: http://localhost:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.378s
[INFO] Finished at: Thu Nov 12 11:37:31 BRST 2015
[INFO] Final Memory: 7M/30M
[INFO] ------------------------------------------------------------------------
[INFO] o.h.m.e.h.MavenExecutionResultHandler - Build failed with exception(s)
[INFO] o.h.m.e.h.MavenExecutionResultHandler - [1] org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-clean-plugin:jar:2.5 in nexus (http://localhost:8081/nexus/content/groups/public)
[DEBUG] Closing connection to remote
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-clean-plugin:jar:2.5 in nexus (http://localhost:8081/nexus/content/groups/public) -> [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
[DEBUG] Waiting for process to finish
[DEBUG] Result: 1
[DEBUG] Skipping watched dependency update for build: Tracker #26 due to result: FAILURE
Finished: FAILURE
And this is my configured Settings on Hudson:
<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
</settings>
I don't know why is it not downloading from central repository into the nexus public repository.
Can someone shed some light into this?
I finally solved it. It was throwing as SSL Exception when trying to access the Central Repository.
This exception was automatically blocking my access.
I went to Central Repository > Configuration and changed the Remote Storage Location url to: http://repo.maven.apache.org/maven2/ and right-clicked on Central and clicked Allow Proxy.
It worked like a charm after that.
I hope this helps someone, because I lost almost two days to this.
EDIT (19/11/2015):
If you're running your openjdk using RedHat/CentOS, there's a bug preventing access via SSL, just as pointed by #rseddon in the comments section. The workarounds are here: https://issues.sonatype.org/browse/NEXUS-7999?focusedCommentId=306680&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-306680
If you're in a hurry, this is the one I used:
Add the following line to ${JAVA_HOME}/jre/lib/security/java.security :
jdk.tls.disabledAlgorithms=EC,ECDHE,ECDH
Now I can use the https link on my Central Repo.

Maven cannot download from Artifactory Repository

I am attempting to connect our Jenkins servers to our Artifactory repository for builds. I've been successful with the Jenkins server at my office location, but I am having problems with a Jenkins server that's on another part of the corporate network.
I've disabled the job, went into the workspace, and tried using mvn directly:
$ mvn clean
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] PROJ Generic Aggregate POM
[INFO] PROJ Generic Module
[INFO] PROJ Generic Features
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building PROJ Generic Aggregate POM 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.vegicorp.net/artifactory/plugins-release/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
And then it freezes before it spits out:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] PROJ Generic Aggregate POM ........................ FAILURE [2:06.295s]
[INFO] PROJ Generic Module ............................... SKIPPED
[INFO] PROJ Generic Features ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:07.160s
[INFO] Finished at: Wed Feb 11 18:16:46 EST 2015
[INFO] Final Memory: 8M/149M
[INFO] ------------------------------------------------------------------------
[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://repo.vegicorp.net/artifactory/plugins-release): Connection to http://repo.vegicorp.net refused: Connection timed out -> [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
to
However, if I attempt to fetch that URL via curl, it downloads without any problems. Same with wget:
$ curl http://repo.vegicorp.net/artifactory/plugins-release/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
<?xml version='1.0' encoding='UTF-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
So, I am able to reach that URL via wget and curl, but Maven itself seems to be having problems fetching that URL. I've added a proxy settings to my ~/.m2/settings.xml, but that doesn't seem to make any difference. We originally setup our Maven repository to redirect from Port 80 to Port 8080, but adding or removing the port number from the URL makes no difference. The settings.xml is from Artifactory which will generate it for you. The same settings.xml works in our office.
Removing the settings.xml allows everything to work because it can download from the standard Maven repo.
My settings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<username>dweintraub</username>
<password>AP8SoMtGnYpACsAwZo5oqUCfSYP</password>
<id>central</id>
</server>
<server>
<username>dweintraub</username>
<password>AP8SoMtGnYpACsAwZo5oqUCfSYP</password>
<id>snapshots</id>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://repo.vegicorp.net/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://repo.vegicorp.net/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://repo.vegicorp.net/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://repo.vegicorp.net/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
And there's a file ~/.m2/repositories/org/apache/maven/plugins/maven-clean-plugins/2.4.1/maven-clean-plugin-2.4.1.pom.lastUpdated with this content:
#NOTE: This is an internal implementation file, its format can be changed without prior notice.
#Wed Feb 11 18:16:46 EST 2015
da39a3ee5e6b4b0d3255bfef95601890afd80709#proxy.gain.tcprod.local\:3128>2f606e371a64780e100321226a9f68a38c8b7906#default-http\://repo.vegicorp.net/artifactory/plugins-release/.lastUpdated=1423695463870
2f606e371a64780e100321226a9f68a38c8b7906#default-http\://repo.vegicorp.net/artifactory/plugins-release/.lastUpdated=1423696543392
http\://repo.vegicorp.net/artifactory/plugins-release/.error=Could not transfer artifact org.apache.maven.plugins\:maven-clean-plugin\:pom\:2.4.1 from/to central (http\://repo.vegicorp.net/artifactory/plugins-release)\: Connection to http\://repo.vegicorp.net refused
http\://repo.fusesource.com/nexus/content/repositories/releases/.lastUpdated=1423694766347
http\://repo.vegicorp.net/artifactory/plugins-snapshot/.error=Could not transfer artifact org.apache.maven.plugins\:maven-clean-plugin\:pom\:2.4.1 from/to snapshots (http\://repo.vegicorp.net/artifactory/plugins-snapshot)\: Connection to http\://repo.vegicorp.net refused
2f606e371a64780e100321226a9f68a38c8b7906#default-http\://repo.vegicorp.net/artifactory/plugins-snapshot/.lastUpdated=1423696606400
http\://repo.fusesource.com/nexus/content/repositories/releases/.error=
http\://repo.vegicorp.net/artifactory/plugins-release/.error=Could not transfer artifact org.apache.maven.plugins\:maven-clean-plugin\:pom\:2.4.1 from/to central (http\://repo.vegicorp.net/artifactory/plugins-release)\: Failed to transfer file\: http\://repo.vegicorp.net/artifactory/plugins-release/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom. Return code is\: 504 , ReasonPhrase\:Gateway Time-out.
That looks like a proxy settings problem. Can you please add the ouptut of mvn help:effective-settings to the question? Thanks!
I'm going to cry...
$ mvn help:effective-settings
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] PROJ Generic Aggregate POM
[INFO] PROJ Generic Module
[INFO] PROJ Generic Features
Downloading: http://repo.fusesource.com/nexus/content/repositories/releases/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
Downloading: http://repo.vegicorp.net/artifactory/plugins-release/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
and then it freezes and displays:
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
Sorry. I can't run mvn help:effective-settings because of my settings...
Yet I don't know why, but after i restarted the nexus process, even before it truly started, maven download process continued.......
my environment: centos 7 , maven 3.6.3, java-1.8.0-openjdk-1.8.0.302

Maven fails to find Jive archetypes from repository when building initial jive project

I'm trying to follow the instructions as specified here: https://community.jivesoftware.com/docs/DOC-3544
For some reason when I execute:
mvn archetype:generate -e -B -DarchetypeGroupId=com.jivesoftware.maven -DarchetypeArtifactId=maven-jive-archetype -DarchetypeVersion=6.0.x-SNAPSHOT -DgroupId=com.jivesoftware.dummycustomer -DartifactId=dummyCustomerSite
It doesn't seem to be able to find the archetype.
I believe I've added all the changes I needed to my ~/.m2/settings.xml (i.e. proxy settings, profile, and jive credentials)
<?xml version="1.0"?>
<settings>
<profiles>
<profile>
<id>jive.archiva</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<repositories>
<repository>
<id>jive.internal</id>
<name>Jive's Repository</name>
<url>https://maven-secure.jivesoftware.com/archiva/repository/jive.internal</url>
</repository>
<repository>
<id>jive.snapshots</id>
<name>Jive's Repository</name>
<url>https://maven-secure.jivesoftware.com/archiva/repository/jive.snapshots</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jive.internal</id>
<name>Jive's Repository</name>
<url>https://maven-secure.jivesoftware.com/archiva/repository/jive.internal</url>
</pluginRepository>
<pluginRepository>
<id>jive.snapshots</id>
<name>Jive's Repository</name>
<url>https://maven-secure.jivesoftware.com/archiva/repository/jive.snapshots</url>
</pluginRepository>
</pluginRepositories>
<properties>
<tomcat6.home><![CDATA[/usr/local/apache-tomcat-6.0.36]]></tomcat6.home>
<cargo.wait>false</cargo.wait>
<jive.setup>true</jive.setup>
<jive.devMode>true</jive.devMode>
<pluginDirs>null</pluginDirs>
</properties>
</profile>
</profiles>
<servers>
<server>
<id>jive.internal</id>
<username>john.smith</username>
<password>password123</password>
</server>
<server>
<id>jive.snapshots</id>
<username>john.smith</username>
<password>password123</password>
</server>
<server>
<id>central</id>
<username>john.smith</username>
<password>password123</password>
</server>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.mycompany.com</host>
<port>8080</port>
<nonProxyHosts>*.mycompany.com|localhost</nonProxyHosts>
</proxy>
</proxies>
</settings>
When running, Maven says it can't find the file:
$mvn archetype:create -DarchetypeGroupId=com.jivesoftware.maven -DarchetypeArtifactId=maven-jive-archetype -DarchetypeVersion=5.0.x-SNAPSHOT -DgroupId=com.cirrus.jive -DartifactId=tap
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-archetype-plugin:2.2:create (default-cli) # standalone-pom ---
[WARNING] This goal is deprecated. Please use mvn archetype:generate instead
[INFO] Defaulting package to group ID: com.cirrus.jive
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.116s
[INFO] Finished at: Thu Apr 11 16:17:50 CDT 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:create (default-cli) on project standalone-pom: Error creating from archetype: org.apache.maven.archetype.downloader.DownloadNotFoundException: Requested com.jivesoftware.maven:maven-jive-archetype:jar:5.0.x-SNAPSHOT download does not exist. Could not find artifact com.jivesoftware.maven:maven-jive-archetype:jar:5.0.x-SNAPSHOT
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=com.jivesoftware.maven -DartifactId=maven-jive-archetype -Dversion=5.0.x-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=com.jivesoftware.maven -DartifactId=maven-jive-archetype -Dversion=5.0.x-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR]
[ERROR] com.jivesoftware.maven:maven-jive-archetype:jar:5.0.x-SNAPSHOT
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
[ERROR] -> [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/MojoExecutionException
EDIT: After following Charlee's suggesions, I get these warnings.
[WARNING] Archetype not found in any catalog. Falling back to central repository (http://repo1.maven.org/maven2).
[WARNING] Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere.
Downloading: http://repo1.maven.org/maven2/com/jivesoftware/maven/maven-jive-archetype/6.0.x-SNAPSHOT/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/com/jivesoftware/maven/maven-jive-archetype/6.0.x-SNAPSHOT/maven-metadata.xml
...
...
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.245s
[INFO] Finished at: Fri Apr 12 10:03:30 CDT 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
It looks like it still can't find the archetype, and then goes to another repository so this isn't exactly what I want.
If I change the argument for archetype version to 5.0 (which I think what my company might want me to use). Setting DarchetypeVersion=5.0.x-SNAPSHOT gives me this (note where it says xxxx actually should say http because stackoverflow is complaining that I can't post html links due to lack of my reputation):
[WARNING] Archetype not found in any catalog. Falling back to central repository (http://repo1.maven.org/maven2).
[WARNING] Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere.
Downloading: xxxx://repo1.maven.org/maven2/com/jivesoftware/maven/maven-jive-archetype/5.0.x-SNAPSHOT/maven-metadata.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.009s
[INFO] Finished at: Fri Apr 12 10:08:44 CDT 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.jivesoftware.maven:maven-jive-archetype:5.0.x-SNAPSHOT) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.jivesoftware.maven:maven-jive-archetype:5.0.x-SNAPSHOT)
Any advice as to why I can't seem to find the 5.0.x- snapshot?
Since the profile named jive.archiva is not active by default. AFAIK, there are 2 possible ways as the following :-
1.Execute the maven by specifying the profile id.
mvn archetype:generate -e -B
-P jive.archiva
-DarchetypeGroupId=com.jivesoftware.maven
-DarchetypeArtifactId=maven-jive-archetype
-DarchetypeVersion=6.0.x-SNAPSHOT
-DgroupId=com.jivesoftware.dummycustomer
-DartifactId=dummyCustomerSite
2.Make the profile active by missing some system property.
<profiles>
<profile>
<id>jive.archiva</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>!disableJive</name>
</property>
</activation>
</profile>
</profile>
You may wondered why we not use the <activeByDefault>true</activeByDefault>. Here may be the answer
This profile will automatically be active for all builds unless another profile in the same POM is activated using one of the previously described methods.All profiles that are active by default are automatically deactivated when a profile in the POM is activated on the command line or through its activation config.
Please see further information at Introduction to Build Profiles.
I hope this may help.

Selenium2 Build Error in Maven apache-maven-3.0.5

I came across following error in Maven when run the command
C:\Users\Man\SelProj>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SelProj 1.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.735s
[INFO] Finished at: Sun Apr 21 15:25:23 EST 2013
[INFO] Final Memory: 6M/106M
[INFO] ------------------------------------------------------------------------
[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:m
aven-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://repo.maven.apache.org/maven2): Connection to
http://repo.maven.apache.org refused: connect: Address is invalid on local machine, or port is not valid on remote machine -> [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
C:\Users\Man\SelProj>
My POM.xml file as follows, I placed the POM file in the folder where I am running the >mvn clean install cmmand
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SelProj</groupId>
<artifactId>SelProj</artifactId>
<version>1.0</version>
<dependencies>
<!-- Selenium2 dependency -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.32.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.5.0</version>
</dependency>
</dependencies>
</project>
What could be the reason. I am running this on windows 8 (64 bit)
I also had same issue. Try to use just >mvn install command without clean.
Since you can access it via the web browser, I understand that there is no any issue about the internet connection.
There are 2 significant possible root causes as the following: -
1. The proxy
If you are behind the proxy, please add the proxy configuration to the settings.xml e.g.
<settings>
.
.
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
</proxy>
</proxies>
.
.
</settings>
Please see Maven - Guide to using proxies for further information.
2. The Anti-Virus / Firewall Issue
Firewall and Anti-virus sometimes prevent Java from running properly, or Windows Firewall (and various other Firewalls) actively prevent Java.exe from reaching out to the Internet to "download stuff" which is a key part of Maven. You may need to configure the Firewall or Anti-virus to add exceptions to allow such actions.
Please see Maven - Maven on Windows for further information.
I hope this may help.

Resources