注意:这个问题最初由Lahiru Gunathilake发布,作为另一个问题的答案.为了清楚起见,我将它作为一个单独的问题移到这里.
当我们进行发布时,我们只需构建本地计算机并执行QA,然后将其托管到存储库中.如果我们运行mvn deploy它会创建新的工件,这会导致在存储库和二进制分发中具有不同的工件,因为我们正在从本地存储库创建二进制分发.但如果有人获得源代码并进行构建,他们将获得另一个.但如果mvn deploy不构建但只是部署它没关系.
我有一些项目有很多maven依赖项.当我调用命令mvn deploy(或其中的一些变体)时,我不仅要将项目本身部署到远程存储库,还要将其所有依赖项部署到远程存储库.这可能吗?我在这个网站上看到了许多"类似的问题",但我似乎无法找到任何简单的东西.我见过的其他所有东西似乎都期待一些额外的功能.我只是想将我的项目及其所有依赖项部署到远程仓库.我正在使用maven编译器插件1.5
这是我的settings.xml的片段.知道我错过了什么吗?
<mirrors>
<mirror>
<!--This is used to direct the public snapshots repo in the
profile below over to a different nexus group -->
<id>nexus-public-snapshots</id>
<mirrorOf>public-snapshots</mirrorOf>
<url>http://{ourServer}/nexus/content/groups/public-snapshots</url>
</mirror>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://{ourServer}/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>development</id>
<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>
<profile>
<!--this profile will allow snapshots to be searched when activated-->
<id>public-snapshots</id>
<repositories>
<repository>
<id>public-snapshots</id>
<url>http://public-snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots> …Run Code Online (Sandbox Code Playgroud) 我认为应该有一些不同,但任何人都可以告诉我细节?
添加此存储库条目是否pom.xml有意义?
...
<distributionManagement>
<repository>
<id>dev</id>
<name>Local repository</name>
<url>file://${user.home}/.m2/repository</url>
</repository>
...
Run Code Online (Sandbox Code Playgroud)
我一直以为默认情况下将默认包含本地仓库。
I am aware of the fact this won't build on Windows. I found the entry above in a pom.xml at my company.