Maven 程序集插件 - 在程序集中包含其他子依赖项

发布于 2024-12-21 06:54:41 字数 1330 浏览 4 评论 0原文

我在一位父母的领导下有四个孩子。其中一个子任务是构建一个包含其他 3 个模块 jar 的 zip。这有效,但它没有获取它们各自的依赖关系。

module-build pom.xml :

...    
    <plugin>
       <artifactId>maven-assembly-plugin</artifactId>               
       <inherited>true</inherited>              
       <configuration>
          <descriptors>
             <descriptor>desc.xml</descriptor>
          </descriptors>
       </configuration>   
    </plugin>
...

desc.xml :

...

        <moduleSets>
            <moduleSet>
                <binaries>
                    <unpack>false</unpack>
                    <dependencySets>
                        <dependencySet>
                            <unpack>false</unpack>
                            <scope>runtime</scope>                  
                            <outputDirectory>lib</outputDirectory>
                        </dependencySet>
                    </dependencySets>
                </binaries>
            </moduleSet>
        </moduleSets>
    ...

未创建生成的“lib”文件夹。

任何帮助将不胜感激。

I have four child pom under one parent. One of the children is to build a zip containing the other 3 modules jars. This works but it doesn't pick up their respective dependencies.

module-build pom.xml :

...    
    <plugin>
       <artifactId>maven-assembly-plugin</artifactId>               
       <inherited>true</inherited>              
       <configuration>
          <descriptors>
             <descriptor>desc.xml</descriptor>
          </descriptors>
       </configuration>   
    </plugin>
...

desc.xml :

...

        <moduleSets>
            <moduleSet>
                <binaries>
                    <unpack>false</unpack>
                    <dependencySets>
                        <dependencySet>
                            <unpack>false</unpack>
                            <scope>runtime</scope>                  
                            <outputDirectory>lib</outputDirectory>
                        </dependencySet>
                    </dependencySets>
                </binaries>
            </moduleSet>
        </moduleSets>
    ...

The resultant 'lib' folder is not created.

Any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浅忆流年 2024-12-28 06:54:41

也许有点晚了,但没关系:)。
您应该在父项目中移动程序集,但这不是真正的问题。

使用插件的版本:

这里是我的,功能齐全(但是是法语,请原谅我;))

<?xml version="1.0" encoding="UTF-8"?>
<assembly
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    <!-- Ce chemin est lié au plugin maven-jar et à la génération du manifest 
        : à manipuler avec précautions -->
    <id>lib</id>
    <formats>
        <format>zip</format>
    </formats>
    <!-- Supprimer la création d'un répertoire dans l'archive au nom du projet -->
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory>/</outputDirectory>
            <unpack>false</unpack>
            <scope>runtime</scope>
        </dependencySet>
    </dependencySets>
</assembly>

这是插件的内置功能(用于获取依赖项)。但我永远不会在多模块项目中使用它,并且我知道使用 ob ModuleSet 存在一些棘手的考虑...

希望这会有所帮助...

Maybe it's a bit late, but no matter :).
You should move your assembly at parent project, but that's not the real problem.

Using version of the plugin :

Here mine, wich is totally functional (but in French, forgive me ;))

<?xml version="1.0" encoding="UTF-8"?>
<assembly
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    <!-- Ce chemin est lié au plugin maven-jar et à la génération du manifest 
        : à manipuler avec précautions -->
    <id>lib</id>
    <formats>
        <format>zip</format>
    </formats>
    <!-- Supprimer la création d'un répertoire dans l'archive au nom du projet -->
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory>/</outputDirectory>
            <unpack>false</unpack>
            <scope>runtime</scope>
        </dependencySet>
    </dependencySets>
</assembly>

This is a built-in feature of the plugin (to get dependencies). But I'd never use it from a multimodule project, and I know that there is some tricky consideration with the use ob ModuleSet ...

Hope that will help...

丘比特射中我 2024-12-28 06:54:41

您是否已将其他 3 个模块指定为该第四个模块的依赖项(位于父级的模块部分中)?

如果你这样做,即使你这样做也应该有效:

<assembly>
 <id>final</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
        <unpack>false</unpack>
        <scope>runtime</scope>                  
        <outputDirectory>lib</outputDirectory>
    </dependencySet>
  </dependencySets>
</assembly>

Do you have specified the other 3 modules as a dependency of this 4th module, next to being in the modules section of the parent?

If you do, it should work even if you do this:

<assembly>
 <id>final</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
        <unpack>false</unpack>
        <scope>runtime</scope>                  
        <outputDirectory>lib</outputDirectory>
    </dependencySet>
  </dependencySets>
</assembly>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文