[英]Maven won't deploy on Sonatype Nexus Repository
[Links are replaced with [http] because StackOverflow does not allow more than 2 links for me...] [链接被替换为[http],因为StackOverflow不允许我使用两个以上的链接...]
I have installed Apache Maven 3.2.3 ([http]maven.apache.org/download.cgi?Preferred= ftp://mirror.reverse.net/pub/apache/ ), and it has downloaded all core plugins. 我已经安装了Apache Maven 3.2.3([http] maven.apache.org/download.cgi?Preferred= ftp://mirror.reverse.net/pub/apache/ ),并且它已经下载了所有核心插件。
Then I installed Sonatype Nenus OSS ([http]www.sonatype.org/nexus/go/) as a WAR application on my XAMPP tomcat server. 然后,我在XAMPP Tomcat服务器上安装了Sonatype Nenus OSS([http] www.sonatype.org/nexus/go/)作为WAR应用程序。
Everything is well set and works. 一切都准备妥当并且可以正常工作。 My unique goal here is to test a deployment of a file from my local Maven to my Nexus repository. 我的唯一目标是测试从本地Maven到Nexus存储库的文件部署。
Here is my POM file project: 这是我的POM文件项目:
<project xmlns="..."
xmlns:xsi="..."
xsi:schemaLocation="...">
<modelVersion>4.0.0</modelVersion>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<version>1.0.0</version>
<distributionManagement>
<repository>
<id>releases</id>
<url>[http]localhost:8080/nexus-2.9.2-01/content/repositories/releases</url>
</repository>
</distributionManagement>
</project>
And here is my Maven configuration file: settings.xml 这是我的Maven配置文件:settings.xml
<settings xmlns="..."
xmlns:xsi="..."
xsi:schemaLocation="...">
<servers>
<server>
<id>releases</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>
The account provided is the default one and it works from the Nexus GUI. 提供的帐户是默认帐户,可以在Nexus GUI中使用。 My Nexus repository "releases" is configured as following: [http]i.stack.imgur.com/Nh3dO.png 我的Nexus存储库“版本”配置如下:[http] i.stack.imgur.com/Nh3dO.png
And when i use the following command: 当我使用以下命令时:
mvn deploy
Or the following: 或以下内容:
mvn deploy:deploy
Which are almost the same as far as I'm concerned... Maven tells me this: [http]i.stack.imgur.com/2vBNx.png 就我而言,这几乎是相同的... Maven告诉我:[http] i.stack.imgur.com/2vBNx.png
And the [Help 1] tells nothing but "see the plugin documentation". [Help 1]除了“请参阅插件文档”外什么也没有。 And the error message tells me that "The repository element is not specified in the POM file", but it actually is... 错误消息告诉我“ POM文件中未指定存储库元素”,但实际上是...
I really don't see what i am missing :/ Thanks for your help 我真的看不到我想念的东西:/谢谢您的帮助
Thank you all for your answers. 谢谢大家的答案。 I don't really have an idea why it works, but using these files works: 我真的不知道为什么会起作用,但是使用这些文件可以起作用:
ArtifactA POM file: ArtifactA 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">
<modelVersion>4.0.0</modelVersion>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<version>1.2.4</version>
<dependencyManagement>
<dependencies>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<id>nexus</id>
<name>Nexus Test Repository</name>
<url>http://localhost:8080/nexus-2.9.2-01/content/repositories/releases</url>
</repository>
</distributionManagement>
</project>
ArtifactB POM file: ArtifactB 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">
<modelVersion>4.0.0</modelVersion>
<groupId>groupA</groupId>
<artifactId>artifactB</artifactId>
<version>1.0.0</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<version>1.2.4</version>
<type>zip</type>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<id>nexus</id>
<name>Nexus Test Repository</name>
<url>http://localhost:8080/nexus-2.9.2-01/content/repositories/releases</url>
</repository>
</distributionManagement>
</project>
Maven settings file: Maven设置文件:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<name>Nexus Test Repository</name>
<url>http://localhost:8080/nexus-2.9.2-01/content/repositories/releases</url>
<mirrorOf>*,!central</mirrorOf>
</mirror>
</mirrors>
</settings>
Deployment script: 部署脚本:
mvn deploy:deploy-file \
-Dfile=artifactA_package.zip \
-Dpackaging=zip \
-DpomFile=pomA1.2.4.xml \
-Durl=http://localhost:8080/nexus-2.9.2-01/content/repositories/releases \
-DrepositoryId=nexus
mvn deploy:deploy-file \
-Dfile=artifactB_package.zip \
-Dpackaging=zip \
-DpomFile=pomB1.0.0.xml \
-Durl=http://localhost:8080/nexus-2.9.2-01/content/repositories/releases \
-DrepositoryId=nexus
Hope it will help the next one :) 希望对下一个有帮助:)
I use wagon-webdav-jackrabbit pluging in combination with something like your configurations. 我将wagon-webdav-jackrabbit插入与类似您的配置结合使用。 It enables Maven to deploy artifacts and files to WebDAV enabled servers. 它使Maven可以将工件和文件部署到支持WebDAV的服务器。
http://maven.apache.org/wagon/wagon-providers/wagon-webdav-jackrabbit/ http://maven.apache.org/wagon/wagon-providers/wagon-webdav-jackrabbit/
Paste this in your pom.xml 将此粘贴到您的pom.xml中
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>2.4</version>
</extension>
</extensions>
</build>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.