Maven - Include dependent libs in jar without unpacking dependencies?

后端 未结 3 458
Happy的楠姐
Happy的楠姐 2021-01-03 21:19

We\'re trying to build a client jar that includes unpacked dependent jar\'s. And the manifest should have class-path entries to the dependent jars. T

3条回答
  •  鱼传尺愫
    2021-01-03 22:04

    Indeed, assembling using jar-with-dependencies causes maven to unpack all the dependencies as ${assembly.dependencySets.dependency.unpack} is set to true in the corresponding assembly descriptor.

    A simple fix would be to provide an assembly descriptor similar to the jar-with-dependencies.xml and modify ${assembly.dependencySets.dependency.unpack} to false, like this:

    EDIT: For an unknown reason, the behavior when using false is not exactly the same and it seems necessary to add / to the fileSet or you don't get the expected result.

    
      uberjar
      
        jar
      
      false
      
        
          false
          runtime
        
      
      
        
          ${project.build.outputDirectory}
          /
        
      
    
    

提交回复
热议问题