You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by DJViking <sv...@gmail.com> on 2013/03/22 15:48:33 UTC

maven deploy artifacts to Nexus repository

Building my project with Jenkins. The workspace is on a jenkins slave node.
This slave node happens to be the same server which is running the Sonatype
Nexus Repository.

Jenkins master is running on user called jenkins. The slave node is
configured for the user called build on that slave, but I don't think thats
a problem.

I'm not sure where the connection happens from, From the jenkins master
server machine to the server machine running Nexus and the slave node, or if
it is trying to run scp from the slave node to the same slave node.

Maven distribution management is configured like this:
    <distributionManagement>
        <repository>
	<id>releases</id>
	<url>scp://maven-vm1/srv/maven/releases</url>
        </repository>
    </distributionManagement>
This directory has chmod 775, where user build is owner and user jenkins has
group access. So access should not be a problem while trying to deploy the
artifacts.

While on Nexus release repository summary section it uses an http URL for
uploading:
    <distributionManagement>
      <repository>
        <id>releases</id>
        <url>http://maven-vm1:8080/nexus/content/repositories/releases</url>
      </repository>
   </distributionManagement>

I want to use SCP for the transfer...

*Errormessage from maven:*
message : Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on
project myApp: Failed to deploy artifacts: Could not transfer artifact
com.company:myApp:jar:2.4.0 from/to releases
(scp://maven-vm1/srv/maven/releases): Cannot connect. Reason: Auth fail
cause : Failed to deploy artifacts: Could not transfer artifact
com.company:myApp:jar:2.4.0 from/to releases
(scp://maven-vm1/srv/maven/releases): Cannot connect. Reason: Auth fail
Stack trace : 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
(default-deploy) on project myApp: Failed to deploy artifacts: Could not
transfer artifact com.company:myApp:jar:2.4.0 from/to releases
(scp://maven-vm1/srv/maven/releases): Cannot connect. Reason: Auth fail
	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.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
	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:601)
	at
org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
	at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
	at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
	at hudson.maven.Maven3Builder.call(Maven3Builder.java:100)
	at hudson.maven.Maven3Builder.call(Maven3Builder.java:66)
	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
	at hudson.remoting.Request$2.run(Request.java:326)
	at
hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy
artifacts: Could not transfer artifact com.company:myApp:jar:2.4.0 from/to
releases (scp://maven-vm1/srv/maven/releases): Cannot connect. Reason: Auth
fail



--
View this message in context: http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven deploy artifacts to Nexus repository

Posted by Baptiste MATHUS <ml...@batmat.net>.
Hi,
I think this is a bad idea since you bypass nexus indexing and artifact
management. Sure it will technically work. But you also doesn't isolate
from some nexus evolution to the storage system that might arise in the
future.

Btw, you might be interested to know that Brian actually works on nexus. So
him saying it's unsupported should ring a bell.

Hth.

Cheers

-- Baptiste
Le 26 mars 2013 13:35, "DJViking" <sv...@gmail.com> a écrit :

> I could take a look at User Token for the settings.xml if using http for
> distribution management is the preferred way. But why is it preferred over
> scp?
>
> I'm not using SCP to Nexus. I'm using SCP to upload the artifacts directly
> to the storage location where Nexus keeps its releases and snapshots.
> Anyway
> I have gotten that approach to work.
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5751848.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: maven deploy artifacts to Nexus repository

Posted by DJViking <sv...@gmail.com>.
I could take a look at User Token for the settings.xml if using http for
distribution management is the preferred way. But why is it preferred over
scp?

I'm not using SCP to Nexus. I'm using SCP to upload the artifacts directly
to the storage location where Nexus keeps its releases and snapshots. Anyway
I have gotten that approach to work.



--
View this message in context: http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5751848.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven deploy artifacts to Nexus repository

Posted by Brian Fox <br...@infinity.nu>.
SCP to Nexus isn't supported, and writing directly to the storage
underneath Nexus isn't really supported either. If the concern is
about having a password in the settings.xml, take a look at User
Token[1]. Ironically this feature started out with a desire to support
SCP but for a number of reasons this wasn't possible to do in a
practical way without structural changes to how Maven loads
extensions.

 [1]http://www.sonatype.com/books/nexus-book/reference/config-sect-usertoken.html

On Mon, Mar 25, 2013 at 4:38 AM, DJViking <sv...@gmail.com> wrote:
> I know uploading through SCP is possible. At my previous workplace we
> uploaded the artifacts through SCP directly to the server location and not
> the web location. I have replicated it right down as I remember it. There
> could possible just be some user authentication problem. I could possibly
> solve this by adding the user build public key into its own authorized_keys
> file. Then maven should have no problem uploading via scp without submitting
> the password for the user.
>
>
>
> *Trying the http URL for distribution management:*
> Uploading:
> http://maven-vm1:8080/nexus/content/repositories/releases/com/company/myApp/2.4.0/myApp-2.4.0.pom
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 1:04.762s
> [INFO] Finished at: Mon Mar 25 09:25:44 CET 2013
> [INFO] Final Memory: 31M/803M
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on
> project myApp: Failed to deploy artifacts: Could not transfer artifact
> com.company:myApp:jar:2.4.0 from/to releases
> (http://maven-vm1:8080/nexus/content/repositories/releases): Failed to
> transfer file:
> http://maven-vm1:8080/nexus/content/repositories/releases/com/company/myApp/2.4.0/myApp-2.4.0.jar.
> Return code is: 401, ReasonPhrase:Unauthorized. -> [Help 1]
>
>
>
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5751781.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven deploy artifacts to Nexus repository

Posted by DJViking <sv...@gmail.com>.
I know uploading through SCP is possible. At my previous workplace we
uploaded the artifacts through SCP directly to the server location and not
the web location. I have replicated it right down as I remember it. There
could possible just be some user authentication problem. I could possibly
solve this by adding the user build public key into its own authorized_keys
file. Then maven should have no problem uploading via scp without submitting
the password for the user.



*Trying the http URL for distribution management:*
Uploading:
http://maven-vm1:8080/nexus/content/repositories/releases/com/company/myApp/2.4.0/myApp-2.4.0.pom
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1:04.762s
[INFO] Finished at: Mon Mar 25 09:25:44 CET 2013
[INFO] Final Memory: 31M/803M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on
project myApp: Failed to deploy artifacts: Could not transfer artifact
com.company:myApp:jar:2.4.0 from/to releases
(http://maven-vm1:8080/nexus/content/repositories/releases): Failed to
transfer file:
http://maven-vm1:8080/nexus/content/repositories/releases/com/company/myApp/2.4.0/myApp-2.4.0.jar.
Return code is: 401, ReasonPhrase:Unauthorized. -> [Help 1]




--
View this message in context: http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5751781.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven deploy artifacts to Nexus repository

Posted by Baptiste MATHUS <ml...@batmat.net>.
Not sure using scp is possible, but answering this precise point would be
more a nexus ML question.
Have you tried using HTTP even temporarily to see if this works? This would
help reduce the hypothesis of where the issue lies, isn't it?

Btw, I think the most often used protocol is http. Maybe if you want
security you could try just using https?

Cheers


2013/3/22 DJViking <sv...@gmail.com>

> Building my project with Jenkins. The workspace is on a jenkins slave node.
> This slave node happens to be the same server which is running the Sonatype
> Nexus Repository.
>
> Jenkins master is running on user called jenkins. The slave node is
> configured for the user called build on that slave, but I don't think thats
> a problem.
>
> I'm not sure where the connection happens from, From the jenkins master
> server machine to the server machine running Nexus and the slave node, or
> if
> it is trying to run scp from the slave node to the same slave node.
>
> Maven distribution management is configured like this:
>     <distributionManagement>
>         <repository>
>         <id>releases</id>
>         <url>scp://maven-vm1/srv/maven/releases</url>
>         </repository>
>     </distributionManagement>
> This directory has chmod 775, where user build is owner and user jenkins
> has
> group access. So access should not be a problem while trying to deploy the
> artifacts.
>
> While on Nexus release repository summary section it uses an http URL for
> uploading:
>     <distributionManagement>
>       <repository>
>         <id>releases</id>
>         <url>http://maven-vm1:8080/nexus/content/repositories/releases
> </url>
>       </repository>
>    </distributionManagement>
>
> I want to use SCP for the transfer...
>
> *Errormessage from maven:*
> message : Failed to execute goal
> org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on
> project myApp: Failed to deploy artifacts: Could not transfer artifact
> com.company:myApp:jar:2.4.0 from/to releases
> (scp://maven-vm1/srv/maven/releases): Cannot connect. Reason: Auth fail
> cause : Failed to deploy artifacts: Could not transfer artifact
> com.company:myApp:jar:2.4.0 from/to releases
> (scp://maven-vm1/srv/maven/releases): Cannot connect. Reason: Auth fail
> Stack trace :
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
> goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
> (default-deploy) on project myApp: Failed to deploy artifacts: Could not
> transfer artifact com.company:myApp:jar:2.4.0 from/to releases
> (scp://maven-vm1/srv/maven/releases): Cannot connect. Reason: Auth fail
>         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.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
>         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:601)
>         at
>
> org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
>         at
> org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
>         at hudson.maven.Maven3Builder.call(Maven3Builder.java:100)
>         at hudson.maven.Maven3Builder.call(Maven3Builder.java:66)
>         at hudson.remoting.UserRequest.perform(UserRequest.java:118)
>         at hudson.remoting.UserRequest.perform(UserRequest.java:48)
>         at hudson.remoting.Request$2.run(Request.java:326)
>         at
>
> hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
>         at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>         at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:722)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy
> artifacts: Could not transfer artifact com.company:myApp:jar:2.4.0 from/to
> releases (scp://maven-vm1/srv/maven/releases): Cannot connect. Reason: Auth
> fail
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
> --
> Baptiste <Batmat> MATHUS - http://batmat.net
> Sauvez un arbre,
> Mangez un castor ! nbsp;! <us...@maven.apache.org>

Re: maven deploy artifacts to Nexus repository

Posted by Manfred Moser <ma...@mosabuam.com>.
For some reason the build extension for Maven site deployment no longer works with latests Maven and site plugins. I found that the best way to configure it is to add the webdav support as a dependency to the site plugin. And have not yet been able to trace down where the problem lies.. 

I have documented this on the book and pushed it live now. 

http://books.sonatype.com/nexus-book/reference/_configuring_maven_for_site_deployment.html

Hope that helps.

manfred

DJViking wrote on 08.10.2014 04:11:

> Trying to also use http with Nexus site deployment didn't work.
> 
> [INFO] --- maven-site-plugin:3.4:deploy (default-deploy) @ MyApp ---
> http://maven-vm1:8081/nexus/content/sites/site/MyApp/ - Session: Opened  
> [INFO] Pushing /home/sverre/workspace/MyApp-R11/target/site
> [INFO]    >>> to http://maven-vm1:8081/nexus/content/sites/site/MyApp/./
> Uploading: .//source-repository.html to
> http://maven-vm1:8081/nexus/content/sites/site/MyApp/
> 
> ##http://maven-vm1:8081/nexus/content/sites/site/MyApp/./source-repository.html
> - Status code: 404
> http://maven-vm1:8081/nexus/content/sites/site/MyApp/ - Session:
> Disconnecting  
> http://maven-vm1:8081/nexus/content/sites/site/MyApp/ - Session:
> Disconnected
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 03:20 min
> [INFO] Finished at: 2014-10-08T13:03:21+01:00
> [INFO] Final Memory: 90M/2309M
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-site-plugin:3.4:deploy (default-deploy) on
> project MyApp: Error uploading site: File:
> http://maven-vm1:8081/nexus/content/sites/site/MyApp/./source-repository.html
> does not exist -> [Help 1]
> [ERROR] 
> 
> I didn't have anything under Nexus sites before this.
> 
> 
> http://books.sonatype.com/nexus-book/reference/_configuring_maven_for_site_deployment.html
> <http://books.sonatype.com/nexus-book/reference/_configuring_maven_for_site_deployment.html> 
> 
> 
>        <site>
>            <id>deployment</id>
>            <name>Sites</name>
>           
> <url>dav:http://meta-vm1:8081/nexus/content/sites/site/${project.artifactId}/${project.version}</url>
>        </site>
> 
> Added the following build extension:
>            <extension>
>                <groupId>org.apache.maven.wagon</groupId>
>                <artifactId>wagon-webdav-jackrabbit</artifactId>
>                <version>2.7</version>
>            </extension>
> 
> Anyhow: I'm not sure, but could this be a problem with Nexus and not Maven?
> 
> 
> 
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5808068.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven deploy artifacts to Nexus repository

Posted by DJViking <sv...@gmail.com>.
Trying to also use http with Nexus site deployment didn't work.

[INFO] --- maven-site-plugin:3.4:deploy (default-deploy) @ MyApp ---
http://maven-vm1:8081/nexus/content/sites/site/MyApp/ - Session: Opened  
[INFO] Pushing /home/sverre/workspace/MyApp-R11/target/site
[INFO]    >>> to http://maven-vm1:8081/nexus/content/sites/site/MyApp/./
Uploading: .//source-repository.html to
http://maven-vm1:8081/nexus/content/sites/site/MyApp/

##http://maven-vm1:8081/nexus/content/sites/site/MyApp/./source-repository.html
- Status code: 404
http://maven-vm1:8081/nexus/content/sites/site/MyApp/ - Session:
Disconnecting  
http://maven-vm1:8081/nexus/content/sites/site/MyApp/ - Session:
Disconnected
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 03:20 min
[INFO] Finished at: 2014-10-08T13:03:21+01:00
[INFO] Final Memory: 90M/2309M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-site-plugin:3.4:deploy (default-deploy) on
project MyApp: Error uploading site: File:
http://maven-vm1:8081/nexus/content/sites/site/MyApp/./source-repository.html
does not exist -> [Help 1]
[ERROR] 

I didn't have anything under Nexus sites before this.


http://books.sonatype.com/nexus-book/reference/_configuring_maven_for_site_deployment.html
<http://books.sonatype.com/nexus-book/reference/_configuring_maven_for_site_deployment.html>  

        <site>
            <id>deployment</id>
            <name>Sites</name>
           
<url>dav:http://meta-vm1:8081/nexus/content/sites/site/${project.artifactId}/${project.version}</url>
        </site>

Added the following build extension:
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-webdav-jackrabbit</artifactId>
                <version>2.7</version>
            </extension>

Anyhow: I'm not sure, but could this be a problem with Nexus and not Maven?



--
View this message in context: http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5808068.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven deploy artifacts to Nexus repository

Posted by Manfred Moser <ma...@mosabuam.com>.
Rather than having two different server sections in settings.xml it is better to use one and the same id in the distribtutionMgt in the pom if they are for the same server. So e.g. if you deploy everything to nexus it could look like this

<distributionManagement>
   <repository>
      <id>nexus</id>
      <url>http://localhost:8081/nexus/content/repositories/releases</url>
    </repository>
    <snapshotRepository>
      <id>nexus</id>
      <url>http://localhost:8081/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
    <site>
      <id>nexus</id>
      <url>dav:http://localhost:8081/nexus/content/sites/site-internal/example</url>
    </site>
  </distributionManagement>

and then settings just needs 

<server>
<id>nexus</id>
....

The same id is also used if you set up mirror in settings e.g.

  <mirror>
<id>nexus</id>

causes the same credentials to be used for accessing the mirror url. You can use that to e.g. disable anonymous access on Nexus and then require credentials.

manfred

DJViking wrote on 08.10.2014 03:06:

> That was it. 
>        <snapshotRepository>
>            <id>snapshots</id>
>           
> <url>http://maven-vm1:8081/nexus/content/repositories/snapshots</url>
>        </snapshotRepository>
>        <repository>
>            <id>releases</id>
>           
> <url>http://maven-vm1:8081/nexus/content/repositories/releases</url>
>        </repository>
> 
> I had to create two servers with both these Id's, then it worked just fine.
> 
> Maybe I missed it, but I couldn't find anywhere in the documentation that
> this id needed to match the id in the server.
> 
> 
> 
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5808061.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven deploy artifacts to Nexus repository

Posted by DJViking <sv...@gmail.com>.
That was it. 
        <snapshotRepository>
            <id>snapshots</id>
           
<url>http://maven-vm1:8081/nexus/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>releases</id>
           
<url>http://maven-vm1:8081/nexus/content/repositories/releases</url>
        </repository>

I had to create two servers with both these Id's, then it worked just fine.

Maybe I missed it, but I couldn't find anywhere in the documentation that
this id needed to match the id in the server.



--
View this message in context: http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5808061.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven deploy artifacts to Nexus repository

Posted by Anders Hammar <an...@hammar.net>.
What's the id defined in the distributionMgmt section? It should map to the
id for the server creds defined in settings.xml ('nexus').

/Anders

On Wed, Oct 8, 2014 at 11:14 AM, DJViking <sv...@gmail.com> wrote:

> I decided to start using HTTP/HTTPS instead of SCP for uploading and
> downloading artefacts from my Nexus server.
> However switching the URL didn't work.
>
> I have created a user in Nexus called build.
> In my settings.xml I have the following configuration taken from
> http://books.sonatype.com/nexus-book/reference/maven-sect-single-group.html
>
>     <server>
>       <id>nexus</id>
>       <username>build</username>
>       <password>XXXXXXXXXXXXXXX</password>
>     </server>
>
>     <mirror>
>       <id>nexus</id>
>       <mirrorOf>*</mirrorOf>
>       <url>http://maven-vm1:8081/nexus/content/groups/public</url>
>     </mirror>
>
>     <profile>
>       <id>nexus</id>
>       <repositories>
>         <repository>
>           <id>central</id>
>           <url>http://central</url>
>           <releases>
>             <enabled>true</enabled>
>             <updatePolicy>always</updatePolicy>
>           </releases>
>           <snapshots>
>             <enabled>true</enabled>
>             <updatePolicy>always</updatePolicy>
>           </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>
>
>   <activeProfiles>
>     <activeProfile>nexus</activeProfile>
>   </activeProfiles>
>
> In my pom.xml I changed the following in distributionManagement
> <url>scp://maven-vm1/srv/maven/snapshots</url>
> to
> <url>http://maven-vm1:8081/nexus/content/repositories/snapshots</url>
>
> Still I cannot get it to upload to Nexus:
>
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy (default-deploy)
> on project MyApp: Failed to deploy artifacts: Could not transfer artifact
> no.company:MyApp:jar:2.5.1-20141008.085615-1 from/to snapshots
> (http://maven-vm1:8081/nexus/content/repositories/snapshots): Failed to
> transfer file:
>
> http://maven-vm1:8081/nexus/content/repositories/snapshots/no/company/MyApp/2.5.1-SNAPSHOT/MyApp-2.5.1-20141008.085615-1.jar
> .
> Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5808056.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: maven deploy artifacts to Nexus repository

Posted by DJViking <sv...@gmail.com>.
I decided to start using HTTP/HTTPS instead of SCP for uploading and
downloading artefacts from my Nexus server.
However switching the URL didn't work.

I have created a user in Nexus called build.
In my settings.xml I have the following configuration taken from
http://books.sonatype.com/nexus-book/reference/maven-sect-single-group.html

    <server>
      <id>nexus</id>
      <username>build</username>
      <password>XXXXXXXXXXXXXXX</password>
    </server>

    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://maven-vm1:8081/nexus/content/groups/public</url>
    </mirror>

    <profile>
      <id>nexus</id>
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </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>

  <activeProfiles>
    <activeProfile>nexus</activeProfile>
  </activeProfiles>

In my pom.xml I changed the following in distributionManagement
<url>scp://maven-vm1/srv/maven/snapshots</url> 
to
<url>http://maven-vm1:8081/nexus/content/repositories/snapshots</url>

Still I cannot get it to upload to Nexus:

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy (default-deploy)
on project MyApp: Failed to deploy artifacts: Could not transfer artifact
no.company:MyApp:jar:2.5.1-20141008.085615-1 from/to snapshots
(http://maven-vm1:8081/nexus/content/repositories/snapshots): Failed to
transfer file:
http://maven-vm1:8081/nexus/content/repositories/snapshots/no/company/MyApp/2.5.1-SNAPSHOT/MyApp-2.5.1-20141008.085615-1.jar.
Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]



--
View this message in context: http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5808056.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven deploy artifacts to Nexus repository

Posted by Wayne Fay <wa...@gmail.com>.
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
> goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
> (default-deploy) on project myApp: Failed to deploy artifacts: Could not
> transfer artifact com.company:myApp:jar:2.4.0 from/to releases
> (scp://maven-vm1/srv/maven/releases): Cannot connect. Reason: Auth fail

"Auth fail" suggests a failure to authenticate. Check the username,
password, etc. Maybe check some logs on the machine you are trying to
connect to with scp. Are you sure your ssh keys and known_hosts etc
are set up properly?

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org