質問

I am running the following:

Apache Maven 3.0.5, Artifactory(Open-Source) 3.1.0

No Jenkins/Hudson, just the default Artifactory setup.

Excerpt from pom.xml:

<distributionManagement>
    <repository>
    <id>ServerA2</id>
    <name>ServerA2-releases</name>
    <url>http://192.168.1.16:8081/artifactory/libs-release-local</url>
    </repository>
    <snapshotRepository>
    <id>ServerA2</id>
    <name>ServerA2-snapshots</name>
    <url>http://192.168.1.16:8081/artifactory/libs-snapshot-local</url>
    </snapshotRepository>
</distributionManagement>

Excerpt from 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>admin</username>
      <password>XXX</password>
      <id>central</id>
    </server>
    <server>
      <username>admin</username>
      <password>XXX</password>
      <id>snapshots</id>
    </server>
    <server>
      <username>admin</username>
      <password>XXX</password>
      <id>ServerA2</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://192.168.1.16:8081/artifactory/libs-release</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://192.168.1.16:8081/artifactory/libs-snapshot</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>plugins-release</name>
          <url>http://192.168.1.16:8081/artifactory/plugins-release</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>plugins-snapshot</name>
          <url>http://192.168.1.16:8081/artifactory/plugins-snapshot</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

Now to the problem:

I have no problems doing mvn deploy when I set the version in pom.xml to <version>1.0</version>. The Artifact was uploaded successfully

But I encounter the following error when I set the version in pom.xml to <version>1.0-SNAPSHOT</version>

Output from mvn clean deploy -X -e

[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ pinder ---
[DEBUG] org.apache.maven.plugins:maven-deploy-plugin:jar:2.7:
[DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-project:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-settings:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-profile:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
[DEBUG]          org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
[DEBUG]       org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG]          junit:junit:jar:3.8.1:compile
[DEBUG]          classworlds:classworlds:jar:1.1-alpha-2:compile
[DEBUG]    org.apache.maven:maven-model:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-artifact:jar:2.0.6:compile
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:1.5.6:compile
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7
[DEBUG]   Imported:  < project>sg.com.pinder:pinder:0.0.1-SNAPSHOT
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7
[DEBUG]   Included: org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
[DEBUG]   Included: junit:junit:jar:3.8.1
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:1.5.6
[DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-project:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-settings:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-profile:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-plugin-registry:jar:2.0.6
[DEBUG]   Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
[DEBUG]   Excluded: classworlds:classworlds:jar:1.1-alpha-2
[DEBUG]   Excluded: org.apache.maven:maven-model:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:2.0.6
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7, parent: sun.misc.Launcher$AppClassLoader@645ad7b2]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy' with basic configurator -->
[DEBUG]   (f) artifact = sg.com.pinder:pinder:jar:0.0.1-SNAPSHOT
[DEBUG]   (f) attachedArtifacts = []
[DEBUG]   (s) localRepository =        id: local
      url: file:///home/Eric_Vader/.m2/repository/
   layout: none

[DEBUG]   (f) offline = false
[DEBUG]   (f) packaging = jar
[DEBUG]   (f) pomFile = /home/Eric_Vader/workspace/pinder/pom.xml
[DEBUG]   (f) project = MavenProject: sg.com.pinder:pinder:0.0.1-SNAPSHOT @ /home/Eric_Vader/workspace/pinder/pom.xml
[DEBUG]   (f) retryFailedDeploymentCount = 1
[DEBUG]   (f) skip = false
[DEBUG]   (f) updateReleaseInfo = false
[DEBUG] -- end configuration --
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://192.168.1.16:8081/artifactory/libs-snapshot-local as admin
Downloading: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Could not find metadata sg.com.pinder:pinder:0.0.1-SNAPSHOT/maven-metadata.xml in ServerA2 (http://192.168.1.16:8081/artifactory/libs-snapshot-local)
[DEBUG] Writing resolution tracking file /home/Eric_Vader/.m2/repository/sg/com/pinder/pinder/0.0.1-SNAPSHOT/resolver-status.properties
Uploading: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20131227.084815-1.jar
Uploading: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20131227.084815-1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.000s
[INFO] Finished at: Fri Dec 27 16:48:15 SGT 2013
[INFO] Final Memory: 18M/216M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project pinder: Failed to deploy artifacts: Could not transfer artifact sg.com.pinder:pinder:jar:0.0.1-20131227.084815-1 from/to ServerA2 (http://192.168.1.16:8081/artifactory/libs-snapshot-local): Failed to transfer file: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20131227.084815-1.jar. Return code is: 401 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project pinder: Failed to deploy artifacts: Could not transfer artifact sg.com.pinder:pinder:jar:0.0.1-20131227.084815-1 from/to ServerA2 (http://192.168.1.16:8081/artifactory/libs-snapshot-local): Failed to transfer file: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20131227.084815-1.jar. Return code is: 401
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy artifacts: Could not transfer artifact sg.com.pinder:pinder:jar:0.0.1-20131227.084815-1 from/to ServerA2 (http://192.168.1.16:8081/artifactory/libs-snapshot-local): Failed to transfer file: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20131227.084815-1.jar. Return code is: 401
    at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:193)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts: Could not transfer artifact sg.com.pinder:pinder:jar:0.0.1-20131227.084815-1 from/to ServerA2 (http://192.168.1.16:8081/artifactory/libs-snapshot-local): Failed to transfer file: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20131227.084815-1.jar. Return code is: 401
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:141)
    at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy(AbstractDeployMojo.java:167)
    at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:157)
    ... 21 more
Caused by: org.sonatype.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not transfer artifact sg.com.pinder:pinder:jar:0.0.1-20131227.084815-1 from/to ServerA2 (http://192.168.1.16:8081/artifactory/libs-snapshot-local): Failed to transfer file: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20131227.084815-1.jar. Return code is: 401
    at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:280)
    at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:211)
    at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:443)
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:137)
    ... 23 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact sg.com.pinder:pinder:jar:0.0.1-20131227.084815-1 from/to ServerA2 (http://192.168.1.16:8081/artifactory/libs-snapshot-local): Failed to transfer file: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20131227.084815-1.jar. Return code is: 401
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:951)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:939)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.run(WagonRepositoryConnector.java:837)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.put(WagonRepositoryConnector.java:467)
    at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:274)
    ... 26 more
Caused by: org.apache.maven.wagon.TransferFailedException: Failed to transfer file: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20131227.084815-1.jar. Return code is: 401
    at org.apache.maven.wagon.providers.http.LightweightHttpWagon.finishPutTransfer(LightweightHttpWagon.java:257)
    at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:423)
    at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:402)
    at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:376)
    at org.apache.maven.wagon.StreamWagon.put(StreamWagon.java:163)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.run(WagonRepositoryConnector.java:811)
    ... 28 more
[ERROR] 
[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

Excerpt from access.log:

2013-12-27 16:48:15,328 [DENIED DEPLOY] libs-snapshot-local:sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20131227.084815-1.jar for anonymous/192.168.1.164.
2013-12-27 16:48:15,335 [DENIED DEPLOY] libs-snapshot-local:sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20131227.084815-1.pom for anonymous/192.168.1.164.

I tried most of the things suggested by other similar questions like: trying setting the Maven Snapshot Version Behavior setting, snapshot tag in settings.xml.

One thing to note is that the log on the Artifactory server does not log anything when the error occur.

役に立ちましたか?

解決 2

Okay, i have figured out a fix for this.

Go to the Artifactory admin page at port 8081(default) navigate to: Admin -> Security -> General

Ensure that the checkbox next to Allow Anonymous Access

is UNCHECKED.

Next, make sure you have the appropriate login information in the settings.xml to access your repository for read and write access.

Doing that fixed this issue for me. CHEERS.

[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://192.168.1.16:8081/artifactory/libs-snapshot-local as admin
Downloading: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Could not find metadata sg.com.pinder:pinder:0.0.1-SNAPSHOT/maven-metadata.xml in ServerA2 (http://192.168.1.16:8081/artifactory/libs-snapshot-local)
[DEBUG] Writing resolution tracking file /home/Eric_Vader/.m2/repository/sg/com/pinder/pinder/0.0.1-SNAPSHOT/resolver-status.properties
Uploading: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20140101.065126-1.jar
Uploaded: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20140101.065126-1.jar (2 KB at 11.1 KB/sec)
Uploading: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20140101.065126-1.pom
Uploaded: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/pinder-0.0.1-20140101.065126-1.pom (2 KB at 18.4 KB/sec)
Downloading: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/maven-metadata.xml
[DEBUG] Could not find metadata sg.com.pinder:pinder/maven-metadata.xml in ServerA2 (http://192.168.1.16:8081/artifactory/libs-snapshot-local)
[DEBUG] Writing resolution tracking file /home/Eric_Vader/.m2/repository/sg/com/pinder/pinder/resolver-status.properties
Uploading: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/maven-metadata.xml
Uploaded: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/0.0.1-SNAPSHOT/maven-metadata.xml (769 B at 8.3 KB/sec)
Uploading: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/maven-metadata.xml
Uploaded: http://192.168.1.16:8081/artifactory/libs-snapshot-local/sg/com/pinder/pinder/maven-metadata.xml (279 B at 3.0 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.890s
[INFO] Finished at: Wed Jan 01 14:51:27 SGT 2014
[INFO] Final Memory: 11M/216M
[INFO] ------------------------------------------------------------------------

他のヒント

That's what's going on - you have 2 repositories under the id central - both libs-release-local (in distributionManagement) and libs-release (in settings). Same for snapshots. That drives Maven crazy in some unpredicted ways (Maven good in that).

So, shadowing central and snapshots in settings is the right way to go, but repositories in distributionManagement should be called differently. I can suggest you copying the respective snippets from repository page in Artifactory: enter image description here

I had a similar error but was caused by the maven-source-plugin. The fix was to remove the "executions" from the child pom. Looks like some issue with jar and jar-no-fork running twice. I worked around it as follows:

Left parent pom with

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-source-plugin</artifactId>
  <version>2.1.2</version>
  <executions>
    <execution>
      <id>attach-sources</id>
      <goals>
        <goal>jar</goal>
      </goals>
    </execution>
  </executions>
</plugin>

and changed child pom from:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
            <execution>
                <id>attach-sources</id>
                <goals>
                    <goal>jar-no-fork</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

to:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
  </plugin>

in web UI, go to http://ip:8081/artifactory/webapp/#/profile . enter the password to unlock.

Copy the Encrypted Password. enter image description here

in settings.xml in <password> set the encrypted password without " .

my problem solved with this way.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top