如何仅将特定模块部署到我的远程仓库?

huangapple go评论65阅读模式
英文:

How could I only deploy a specific module to my remote repository?

问题

我有一个包含多个模块的Maven项目,但我只想将其中一个模块部署到远程仓库服务器。我尝试将 distributionManagement 放在我想要部署的模块的pom文件中,但它只能放在主pom文件中。我该怎么做?

谢谢。

编辑:通过将以下内容放入我不想要部署的模块中,问题已解决:

<build>
  <pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>3.0.0-M1</version>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>
  </pluginManagement>
</build>
英文:

I have a Maven project with several modules, but I only want one to be deployed to my remote repository server. I tried to put the distributionManagement in the pom of my module that I want to deploy, but it can only be put in the main pom. How could I do this?

Thank you.

Edit: Fixed by putting

&lt;build&gt;
  &lt;pluginManagement&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-deploy-plugin&lt;/artifactId&gt;
        &lt;version&gt;3.0.0-M1&lt;/version&gt;
        &lt;configuration&gt;
          &lt;skip&gt;true&lt;/skip&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/pluginManagement&gt;
&lt;/build&gt;

to the modules that I don't want to be deployed.

答案1

得分: 0

将此模块变成一个独立的项目。从其pom文件中移除父级部分。

英文:

Make this module an independent project. Remove parent section from its pom file.

答案2

得分: 0

你可以通过将Maven部署插件的skip属性设置为true,应用于所有其他模块,来实现这一点。

但问题是:如果你后面只需要其中一个模块,为什么要使用多模块项目呢?难道不应该对它进行拆分吗?

英文:

You can do that by setting the skip property of the maven deploy plugin to true in all other modules.

But: Why is it multi-module project if you only need one of the modules later? Shouldn't it be split up?

huangapple
  • 本文由 发表于 2020年8月25日 01:17:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/63565762.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定