在maven settings.xml中指定要在Nexus中部署的特定存储库url



我是Maven和Nexus的新成员。我在本地Nexus上部署我的maven项目(使用IntelliJ开发(时遇到了问题。您可以在附件中找到我的maven settings.xml

我的目标是在不修改pom.xml文件的情况下部署我的项目,只修改~/.m2/settings.xml

我尝试了以下命令(有效(:$mvn clean deploy-DaltDeploymentRepository=nexus::default::http://192.168.1.8:8081/repository/maven-快照

但我只想要相同的结果:$mvn干净部署

知道吗?

感谢

<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">
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://192.168.1.8:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<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>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>

<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>******</password>
</server>
</servers>
</settings>

您可以将<properties>节添加到settings.xml并添加

<altDeploymentRepository>nexus::default::http://192.168.1.8:8081/repository/maven-snapshots</altDeploymentRepository>

最新更新