mvn install package from GitHub package registry - maven

I've followed steps given in this document to deploy a package on GitHub package registry, I'm able to successfully deploy a package. That can be seen here.
Now I'm trying to install this as a dependency in another project. As given in the above link I added this dependency in my pom file.
<dependency>
<groupId>com.github.ashishchopra/github_package_registry</groupId>
<artifactId>group-upload.artifct-upload</artifactId>
<version>0.0.1</version>
</dependency>
Which obviously throws me this error:
[ERROR] 'dependencies.dependency.groupId' for com.github.ashishchopra/github_package_registry:group-upload.artifct-upload:jar with value 'com.github.ashishchopra/github_package_registry' does not match a valid id pattern.
Now I remove the part before / in the groupId and made dependency like this:
<dependency>
<groupId>github_package_registry</groupId>
<artifactId>group-upload.artifct-upload</artifactId>
<version>0.0.1</version>
</dependency>
Now I'm getting this error:
Downloading: https://maven.pkg.github.com/ashishchopra/github_package_registry/group-upload.artifct-upload/0.0.1/group-upload.artifct-upload-0.0.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.275 s
[INFO] Finished at: 2019-10-10T19:47:42+05:30
[INFO] Final Memory: 18M/67M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project artifct-download: Could not resolve dependencies
for project group-download:artifct-download:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at github_package_registry:group-upload.artifct-upload:jar:0.0.1: Failed to read artifact descriptor for github_package_registry:group-upload.artifct-upload:jar:0.0.1: Could not transfer artifact github_package_registry:group-upload.artifct-upload:pom:0.0.1 from/to github (https://maven.pkg.github.com/ashishchopra): Failed to transfer file: https://maven.pkg.github.com/ashishchopra/github_package_registry/group-upload.artifct-upload/0.0.1/group-upload.artifct-upload-0.0.1.pom. Return code is: 400 , ReasonPhrase:Bad Request. -> [Help 1]
I also tried removing groupId. part from artifactId in dependency and made it like this:
<dependency>
<groupId>github_package_registry</groupId>
<artifactId>artifct-upload</artifactId>
<version>0.0.1</version>
</dependency>
This time I'm getting this error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.417 s
[INFO] Finished at: 2019-10-10T19:52:08+05:30
[INFO] Final Memory: 18M/67M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project artifct-download: Could not resolve dependencies for project group-download:artifct-download:jar:0.0.1-SNAPSHOT: Could not find artifact github_package_registry:artifct-upload:jar:0.0.1 in central (https://repo1.maven.org/maven2) ->
[Help 1]
So with no combination, it seems to be working.
Content of my ~/.m2/settings.yml file:
<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">
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>github</id>
<name>GitHub ashishchopra Apache Maven Packages</name>
<url>https://maven.pkg.github.com/ashishchopra</url>
</repository>
</repositories>
</profile>
</profiles>
<servers>
<server>
<id>github</id>
<username>ashishchopra</username>
<password>XXXX</password>
</server>
</servers>
These are direct steps from their documentation, nothing fancy, still, I'm not able to make it work.
In-fact pom and jar files are present at this link
https://maven.pkg.github.com/ashishchopra/github_package_registry/group-upload.artifct-upload/0.0.1/artifct-upload-0.0.1.pom
https://maven.pkg.github.com/ashishchopra/github_package_registry/group-upload.artifct-upload/0.0.1/artifct-upload-0.0.1.jar

As per the documentation you pointed to, the URL of the maven repository should include the name of your GitHub repository, i.e. github_package_registry. So that’s what you need in your settings.xml:
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/ashishchopra/github_package_registry</url>
</repository>
</repositories>
And in your pom.xml, just use the dependency described in your GitHub Packages page:
<dependency>
<groupId>group-upload</groupId>
<artifactId>artifct-upload</artifactId>
<version>0.0.1</version>
</dependency>

for some reason is not looking in the right repo, try to put this at the top of your settings.yml
<repository>
<id>github</id>
<name>GitHub ashishchopra Apache Maven Packages</name>
<url>https://maven.pkg.github.com/ashishchopra</url>
</repository>

Related

Unable to get *.tar.gz files from Nexus Repository

I'm tring to install Maven Wrapper and get "Error installing the Maven Wrapper.: Server returned HTTP response code: 401" from my Nexus Repository.
To reproduce the error I can just remove a local cache of Maven Wrapper and try to install it to an empty folder:
rm -R ~/.m2/repository/io/takari/maven-wrapper/0.5.6/
mvn -N io.takari:maven:wrapper -Dmaven=3.8.4
The output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven:0.7.7:wrapper (default-cli) # standalone-pom ---
Downloading from nexus: http://localhost:8081/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.pom
Downloaded from nexus: http://localhost:8081/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.pom (2.4 kB at 15 kB/s)
Downloading from nexus: http://localhost:8081/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
Downloaded from nexus: http://localhost:8081/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar (51 kB at 1.5 MB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.103 s
[INFO] Finished at: 2022-03-21T10:45:51+05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.takari:maven:0.7.7:wrapper (default-cli) on project standalone-pom: Error installing the Maven Wrapper.: Server returned HTTP response code: 401 for URL: http://localhost:8081/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.tar.gz -> [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
pom and jar files are downloaded just fine. The problem is with tar.gz file only.
Here is my settings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<settings
xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>1</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<url>http://localhost:8081/repository/maven-public</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<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>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
The URL http://localhost:8081/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.tar.gz?describe is retrived just fine in a browser:
Code 200
Content-Type application/x-gzip
Size 51848
Error 401 is unauthorize error
Did you try to put an autologin config file in your user's home directory already?
Example: /Users/my_username/.netrc
machine nexus.somewhere.com
login correct_user
password correct_password
You also need to ensure the account is available and have valid permission to target lib

maven deploy does not work for releases

Hi I am a beginner for maven build tool. I built a simple maven JavaEE project and I tried to build it remote nexus repository. But i can deploy successfully only for snapshots. Releases deploying gives 400 bad request error.
here is my Setting.xml configuration
<servers>
<server>
<id>****</id>
<username>****</username>
<password>****</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>central</mirrorOf>
<url>http://******:8081/nexus/content/groups/net.******.timetrack/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>*****</id>
<url>http://******:8081/nexus/content/groups/net.*******.timetrack/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>******</id>
<url>http://******:8081/nexus/content/groups/net.******.timetrack/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
and here is my pom.xml's distribution management
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>*****</id>
<name>******</name>
<url>http://*******:8081/nexus/content/groups/net.******.timetrack/</url>
<layout>default</layout>
</repository>
<snapshotRepository>
<uniqueVersion>true</uniqueVersion>
<id>*****</id>
<name>***** Snapshots</name>
<url>http://******:8081/nexus/content/repositories/snapshots/</url>
<layout>legacy</layout>
</snapshotRepository>
</distributionManagement>
If I run mvn clean deploy with (for a snapshot)
<groupId>net.*****.*****</groupId>
<artifactId>*****-**-****</artifactId>
<version>1.4-SNAPSHOT</version>
<packaging>war</packaging>
then successfully deploy in to nexus repository snapshot directory.
If it I run mvn clean deploy with (for a release)
<groupId>net.*****.****</groupId>
<artifactId>****-***-*****</artifactId>
<version>1.4.1</version>
<packaging>war</packaging>
then it gives 400-bad request error
Here is the log for the error
[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-war) # ****-****-***** ---
[INFO] Packaging webapp
[INFO] Assembling webapp [*****-time-tracker] in [/home/dilanka/Projects/time_tracker/samples/GitLab/****/***-time-tracker/target/*****-time-tracker-1.4]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/dilanka/Projects/time_tracker/samples/GitLab/*****/****-time-tracker/src/main/webapp]
[INFO] Webapp assembled in [115 msecs]
[INFO] Building war: /home/dilanka/Projects/time_tracker/samples/GitLab/TimeTracker/*****-time-tracker/target/****-time-tracker-1.4.war
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # ****-time-tracker ---
[INFO] Installing /home/dilanka/Projects/time_tracker/samples/GitLab/TimeTracker/****-time-tracker/target/****-time-tracker-1.4.war to /home/dilanka/maven3-repo/net/*****/timetrack/****-time-tracker/1.4/****-time-tracker-1.4.war
[INFO] Installing /home/dilanka/Projects/time_tracker/samples/GitLab/TimeTracker/****-time-tracker/pom.xml to /home/dilanka/maven3-repo/net/****/timetrack/****-time-tracker/1.4/****-time-tracker-1.4.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) # ****-time-tracker ---
Uploading: http://*****:8081/nexus/content/groups/net.*****.timetrack/net/****s/timetrack/***-time-tracker/1.4/****-time-tracker-1.4.war
Uploading: http://*****:8081/nexus/content/groups/net.****.timetrack/net/****/timetrack/****-time-tracker/1.4/****-time-tracker-1.4.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.790 s
[INFO] Finished at: 2016-01-08T15:28:08+05:30
[INFO] Final Memory: 32M/252M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project ****-time-tracker: Failed to deploy artifacts: Could not transfer artifact net.****.timetrack:*****-time-tracker:war:1.4 from/to ***** (http://*****:8081/nexus/content/groups/net.****.timetrack/): Failed to transfer file: http://*****:8081/nexus/content/groups/net.****.timetrack/net/*****/timetrack/*****-time-tracker/1.4/****-time-tracker-1.4.war. Return code is: 400, ReasonPhrase: Bad Request. -> [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
If any body please help me to solve this problem.
Thanks.
You can deploy a release version of a given artifact exactly once to a given Nexus instance.
If the same version already exists in your Nexus, you'll get an error like the one you're seeing.
<url>http://*******:8081/nexus/content/groups/net.****.timetrack/</url>
You can't deploy into a group repository, change this URL to be the URL of a hosted release repository.

WSO2 samples Maven pom.xml

I would like to package my project for wso2 into Maven, and first step is to place WSO2 samples into a maven build and then build upon that...however, not able to create pom.xml that will compile the sample code so far.
After following some trails online: WSO2 BAM 2.0 libraries in Maven
Which included downloading and installing a pom into local repository because it did not exist on wso2 repository, still getting errors...
Thanks for any assistance or best yet, if someone has a pom.xml for WSO2 samples and can share it...
Here is the current pom:
<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">
<parent>
<groupId>org.wso2.carbon</groupId>
<artifactId>carbon-components</artifactId>
<version>3.2.0</version>
</parent>
<repositories>
<repository>
<id>wso2-maven2-repository</id>
<name>WSO2 Maven2 Repository</name>
<url>http://dist.wso2.org/maven2</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
</repository>
</repositories>
<modelVersion>4.0.0</modelVersion>
<groupId>acme</groupId>
<artifactId>acme.wso2</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.bam.agent</artifactId>
<version>3.2.4</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.11</version>
</dependency>
</dependencies>
</project>
Here are the errors I receive on build:
c:\projects\acme.wso2> mvn compile
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for acme:acme.wso2:jar:1.0-SNAPSHOT
[WARNING] 'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.wso2.carbon:org.wso2.carbon.core.common:jar -> duplicate declaration of version ${carbon.platform.version} # org.wso2.carbon:c
arbon-components:3.2.0, C:\Users\Tony\.m2\repository\org\wso2\carbon\carbon-components\3.2.0\carbon-components-3.2.0.pom, line 1025, column 25
[WARNING] 'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.wso2.carbon:org.wso2.carbon.mashup.jsservices.stub:jar -> duplicate declaration of version ${carbon.platform.version} # org.ws
o2.carbon:carbon-components:3.2.0, C:\Users\Tony\.m2\repository\org\wso2\carbon\carbon-components\3.2.0\carbon-components-3.2.0.pom, line 2128, column 25
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building acme.wso2 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for net.sf.saxon:saxon:jar:8.9 is missing, no dependency information available
Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/eclipse/osgi/org.eclipse.osgi.services/3.2.0.v20
090520-1800/org.eclipse.osgi.services-3.2.0.v20090520-1800.pom
[WARNING] Checksum validation failed, expected <!DOCTYPE but is 8edc83998e0bf2a8867395883f3853eb901be267 for http://maven.wso2.org/nexus/content/groups/wso2-public/org/eclipse/osgi/org.eclipse.osgi.services/3.2.0.v20090520-1800/org.eclipse.osgi.services-3.2.0.v20090520-1800.pom
Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/bsf/bsf-all/3.0/bsf-all-3.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.956s
[INFO] Finished at: Thu Feb 07 16:43:12 EST 2013
[INFO] Final Memory: 12M/161M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project acme.wso2: Could not resolve dependencies for project acme:acme.wso2:jar:1.0-SNAPSHOT:
Failed to collect dependencies for [org.wso2.carbon:org.wso2.carbon.bam.agent:jar:3.2.4 (compile),
javax:javaee-api:jar:6.0 (provided),
org.apache.axis2:axis2:jar:1.5.1 (compile),
org.apache.ws.commons.axiom:axiom-api:jar:1.2.11 (compile)]:
Failed to read artifact descriptor for org.eclipse.osgi:org.eclipse.osgi.services:jar:3.2.0.v20090520-1800:
Could not transfer artifact org.eclipse.osgi:org.eclipse.osgi.services:pom:3.2.0.v20090520-1800 from/to wso2-nexus
(http://maven.wso2.org/nexus/content/groups/wso2-public/):
Checksum validation failed, expected <!DOCTYPE but is 8edc83998e0bf2a8867395883f3853eb901be267 -> [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/DependencyResolutionException
Can you build this pom file just like this,
mvn clean install -c
This will ignore the checkssum error.
Replace your repositories tag with the following. Your dependency will be available in one of these repositories. And if the checksum error seems to persists, please refer to #Harsha's answer.
<repositories>
<repository>
<id>wso2-nexus</id>
<name>WSO2 internal Repository</name>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
<repository>
<id>wso2.releases</id>
<name>WSO2 internal Repository</name>
<url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
<repository>
<id>wso2.snapshots</id>
<name>WSO2 Snapshot Repository</name>
<url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>

Why Maven wants to download ALL my dependecies from ALL my repostories?

My pom.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pw</groupId>
<artifactId>pocketwaitress-android</artifactId>
<name>PocketWaitress Android</name>
<packaging>apk</packaging>
<version>1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>org.springframework.maven.snapshot</id>
<name>Spring Maven Snapshot Repository</name>
<url>http://maven.springframework.org/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository><!-- For developing against latest Spring milestones -->
<repository>
<id>org.springframework.maven.milestone</id>
<name>Spring Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<build>
<sourceDirectory>src</sourceDirectory>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<sdk>
<platform>7</platform>
<path>D:/WorkFolder/Android-SDK2</path>
</sdk>
<emulator>
<avd>WVGA-2.1</avd>
</emulator>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>false</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.android</groupId>
<artifactId>spring-android-rest-template</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.pw</groupId>
<artifactId>model</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.codehouse.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.9</version>
</dependency>
<dependency>
<groupId>org.codehouse.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.9</version>
</dependency>
</dependencies>
The latest addons to this are the Jackson dependecies.
The output of deploy is:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building PocketWaitress Android 1.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/codehouse/jackson/jackson-core-asl/1.9.9/jackson-core-asl-1.9.9.pom
[WARNING] The POM for org.codehouse.jackson:jackson-core-asl:jar:1.9.9 is missing, no dependency information available
Downloading: http://repo1.maven.org/maven2/org/codehouse/jackson/jackson-mapper-asl/1.9.9/jackson-mapper-asl-1.9.9.pom
[WARNING] The POM for org.codehouse.jackson:jackson-mapper-asl:jar:1.9.9 is missing, no dependency information available
Downloading: http://repo1.maven.org/maven2/org/codehouse/jackson/jackson-core-asl/1.9.9/jackson-core-asl-1.9.9.jar
Downloading: http://repo1.maven.org/maven2/org/codehouse/jackson/jackson-mapper-asl/1.9.9/jackson-mapper-asl-1.9.9.jar
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping PocketWaitress Android
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.313s
[INFO] Finished at: Wed Sep 12 12:50:48 CEST 2012
[INFO] Final Memory: 20M/174M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project pocketwaitress-android: Could not resolve dependencies for project com.pw:pocketwaitress-android:apk:1.0: The following artifacts could not be resolved: org.codehouse.jackson:jackson-core-asl:jar:1.9.9, org.codehouse.jackson:jackson-mapper-asl:jar:1.9.9: Failure to find org.codehouse.jackson:jackson-core-asl:jar:1.9.9 in http://maven.springframework.org/milestone was cached in the local repository, resolution will not be reattempted until the update interval of org.springframework.maven.milestone has elapsed or updates are forced -> [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/DependencyResolutionException
Apparently maven manages to download the jackson dependecies, from the central maven repository but then it tries to download them from http://maven.springframework.org/milestone too!
Why is that? Do i need to define somehow which dependencies are fetched from which repo? Makes no sense...
I've seen funky errors like this before and I usually do two things:
First, make sure your internet connection is working correctly - if Maven cannot connect to a particular repository, it will search additional repositories for the artifact and can potentially give misleading error messages (such as appearing to search the wrong repo).
Next, run your build again with the -U flag to force updates.
Again, not certain this is the problem, but I've seen similar behavior fixed by the above steps. Might be worth a shot.
Your jackson dependencies are not downloaded. When download is successful you will see something likeDownloaded: xyRecheck your dependencies.

Maven: Trying to Deploy with credentials in settings.xml file

This seemed to be working last week and now it doesn't.
We use Artifactory as our Maven repository.
I am deploying a jar and pom using the deploy:deploy-file goal
Our Artifactory repository requires authentication to deploy.
I can deploy to the repository by embedding my credentials in the server URL on the command line:
$ mvn deploy:deploy-file \
-Durl=http://deployer:swordfish#repo.veggiecorp.com/artifactory/ext-release-local \
-Dfile=crypto.jar \
-DpomFile=pom.xml \
-Did=VeggieCorp
yadda...yadda...yadda...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.962s
[INFO] Finished at: Mon Aug 20 10:06:04 CDT 2012
[INFO] Final Memory: 4M/118M
[INFO] ------------------------------------------------------------------------
However, that whole deployment gets logged and my credentials would be visible in the log. Therefore, I want to be able to deploy without my credentials on the command line. To do that, I have a $HOME/.m2/settings.xml file:
<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.veggiecorp.com</host>
<port>3128</port>
<nonProxyHosts>*.veggiecorp.com</nonProxyHosts>
</proxy>
</proxies>
<servers>
<server>
<id>VeggieCorp</id>
<username>deployer</username>
<password>swordfish</password>
</server>
</servers>
<profiles>
<profile>
<id>VeggieCorp</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>VeggieCorp</id>
<name>VeggieCorp's Maven Repository</name>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<url>http://repo.veggiecorp.com/artifactory/ext-release-local</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>VeggieCorp</activeProfile>
</activeProfiles>
</settings>
Now, I'll try deploying again, but without putting the user name and password in the URL:
$ mvn deploy:deploy-file \
-Durl=http://repo.veggiecorp.com/artifactory/ext-release-local \
-Dfile=crypto.jar \
-DpomFile=pom.xml \
-Did=VeggieCorp
yadda...yadda...yadda
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.751s
[INFO] Finished at: Mon Aug 20 10:17:15 CDT 2012
[INFO] Final Memory: 4M/119M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy- file (default-cli) on project crypto:
Failed to deploy artifacts: Could not transfer artifact
com.veggiecorp:crypto:jar:2.0.0 from/to remote-repository
(http://mvn.veggiecorp.com/artifactory/ext-release-local):
Failed to transfer file:
http://mvn.veggiecorp.com/artifactory/ext-release-local/com/veggiecorp/crypto/2.0.0/crypto-2.0.0.jar.
Return code is: 401, ReasonPhrase:Unauthorized. -> [Help 1]
(I've reformatted the output to make it easier to see. I'm getting a 401 "Unauthorized" error)
So, what am I doing wrong? Why can't I use my .settings.xml file to do my credentials? The proxy part does work because it can download the needed plugins from the main Maven repository.
You need to provide the repositoryId=VeggieCorp (not id) property so that maven knows from which <server> configuration it has to read the credentials.
$ mvn deploy:deploy-file \
-Durl=http://repo.veggiecorp.com/artifactory/ext-release-local \
-Dfile=crypto.jar \
-DpomFile=pom.xml \
-DrepositoryId=VeggieCorp
See http://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html
You can also specify your snapshot repository id in distributionManagement
<distributionManagement>
<repository>
<id>releases</id>
<url>${env.MAVEN_RELEASE_REPOSITORY_URL}</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>${env.MAVEN_SNAPSHOT_REPOSITORY_URL}</url>
</snapshotRepository>
</distributionManagement>
the ids here should match ones in servers

Resources