Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to deploy artifacts: Could not find artifact

I want to deploy a library to my companies remote repository.

It's the first time I want to deploy the library project to the remote repository.

I get the following error message:

org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com/)

Maybe I understand something complete wrong, but the error message says, that in the remote repository doesn't exist the artifact that I try to deploy for the first time. So of course there is not such artifact. Why does maven tries to fetch the artifact when I try to upload the artifact?

My pom file:

<?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.0http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.http</groupId>
<artifactId>httpkit</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>httpkit</name>

<properties>
    <platform.version> 4.1.1.4</platform.version>
</properties>

<dependencies>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>${platform.version}</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<!-- Deploy to internal maven repository -->
<distributionManagement>
    <repository>
      <id>internal.repo</id>
      <name>Internal Repository</name>
      <url>http://jenkins.internal.com/</url>
    </repository>
</distributionManagement>

<build>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <version>3.5.3</version>
            <configuration>
                <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                <resourceDirectory>${project.basedir}/res</resourceDirectory>
                <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                <sdk>
                    <platform>16</platform>
                </sdk>
               <undeployBeforeDeploy>true</undeployBeforeDeploy>
            </configuration>
            <extensions>true</extensions>
        </plugin>

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>

    </plugins>
</build>
</project>

I call

mvn deploy

from command line

Any suggestion how to fix that problem?

EDIT: The failure log (running mvn deploy -X)

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project httpkit: Failed to deploy artifacts: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com) -> [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 httpkit: Failed to deploy artifacts: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com)
    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:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    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:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy artifacts: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com)
    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 find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com)
    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 find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com)
    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.ArtifactNotFoundException: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com/)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:947)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
    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
[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
like image 569
sockeqwe Avatar asked Apr 19 '13 15:04

sockeqwe


5 Answers

Have you tried to add the server in your settings.xml file? The default settings xml is located in your ~/.m2/ directory. Should contain something like that:

<servers>
        <server>
            <id>my-internal-nexus-repo</id>
            <username>yourUserName</username>
            <password>yourPassword</password>
        </server>
</servers>

Here is a link to the http://maven.apache.org/settings.html maven doc for adding servers.

One other thing which might be a shot in the dark. I've noticed you are trying to connect to what the url suggests might be a Jenkins instance. Jenkins is a Continious Integration server and seemed strange to me that you are finding your repositories there. I would expect a Nexus url or something.

like image 125
Nikola Yovchev Avatar answered Nov 14 '22 03:11

Nikola Yovchev


A possible cause is that you simply misspelt the repository name, or used the wrong repository name entirely

So using the OP's example:

Failed to deploy artifacts: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.
repo (http://jenkins.intrnal.com)

could actually mean

Failed to deploy artifacts: Could not find internal.repo (http://jenkins.intrnal.com)
like image 27
randomsimon Avatar answered Nov 14 '22 03:11

randomsimon


We have faced this issue. After couple of hours, we figured it is disk space issue in internal repository.

like image 5
Mahendran Mookkiah Avatar answered Nov 14 '22 05:11

Mahendran Mookkiah


I ran into a similar problem and solved by

  1. Adding my nexus server as a nonProxyHost in settings.xml
  2. Setting the 3rd party's Repository Policy to Release rather than Snapshot.

See more details in my stackoverflow answer.

Note that I was doing a "mvn deploy:deploy-file" (which uploads a 3rd party artifact to the shared repository) whereas you are doing a "mvn deploy" (which uploads YOUR artifact from your built project to the shared repository), but the root cause maybe the same.

like image 4
Shaun Abram Avatar answered Nov 14 '22 05:11

Shaun Abram


In my case my server url in snapshotRepository section of pom.xml was pointing to http, while my internal repository was hosted in https.

like image 1
user320550 Avatar answered Nov 14 '22 03:11

user320550