maven程序集插件模块集源指令不包括任何文件,也不匹配包含的模块

我有一个多模块maven项目,我正在尝试使组件插件的模块集源部分工作。

我有模块“ module_parent ”,“ module_a ”和“ module_assembly ”。

module_amodule_assemblymodule_parent的 子代

module_assemblymodule_a上有一个声明的pom依赖

module_assmebly有程序集插件,assembly.xml看起来像:

  bin  zip  false   true  com.mystuff:module_a     /  **/target/**  /        

我在module_a的module_assembly中有一个显式的依赖项。 module_assembly的pom中的依赖关系如下:

   com.mystuff module_a 1.0 pom   

我打开调试时从mvn包获得的错误是:

 [DEBUG] All known ContainerDescritporHandler components: [metaInf-services, plexus, metaInf-spring, file-aggregator] [DEBUG] No dependency sets specified. [WARNING] The following patterns were never triggered in this artifact inclusion filter: o 'com.mystuff:module_a' [DEBUG] Cannot find ArtifactResolver with hint: project-cache-aware org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException role: org.apache.maven.artifact.resolver.ArtifactResolver roleHint: project-cache-aware at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:257) at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:233) at  at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) Caused by: java.util.NoSuchElementException at java.util.Collections$EmptyIterator.next(Collections.java:3006) at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:253) ... 43 more [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2:single (make-assembly) on project apm-server-distribution: Failed to create assembly: Error creating assembly archive bin: You must set at least one file. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2:single (make-assembly) on project apm-server-distribution: Failed to create assembly: Error creating assembly archive bin: You must set at least one file. 

我认为主要问题是这个警告线:

 [WARNING] The following patterns were never triggered in this artifact inclusion filter: o 'com.mystuff:module_a' 

我该如何纠正?

如果module_assembly没有对模块的子引用,则不会将其视为模块。 请注意,此处的内容仅指儿童: http : //maven.apache.org/plugins/maven-assembly-plugin/advanced-module-set-topics.html

如果要执行此操作,则需要使用dependencySet而不是moduleSet。

PS – 谢谢您的赏金!

它使用以下配置为我工作:

  false true 

我只是调试程序集插件,因为我有类似的问题,我认为问题是true 。 最重要的是,还有标签 ,这可能就是你想要的。

  bin  zip  false   false true> ...    

你正在尝试什么不起作用,因为module_a不是module_assembly的子模块。

以下是您可以做的一些想法:

  • 将相关文件包含在jar中(可能是源插件帮助)并使用dependencySet。
  • 更改模块结构,使module_assembly为parent, module_parentmodule_a为子模块。 在cource中,依赖结构保持不变。
  • 只需在程序集中使用指向另一个项目的相对路径的文件集(丑陋!)