2017-10-09 3 views
0

配布可能なアーカイブを作成しようとしているときにmavenアセンブリプラグインを使用する際に問題があります。すべては ですが、いくつかの依存関係のjarがアーカイブのlibディレクトリにないことを除いて正常です。たとえば、hamcrest-core.jar、xnio-nio-3.3.6.Final.jar、objenesis-2.5.jarなどのいくつかのjarファイルは追加されません。含まれない理由はありますか? maven-dependency-pluginには、ターゲット/ lib内のすべての依存関係jarが含まれています。ここで Mavenアセンブリのプラグイン依存関係のjarsが見つかりません

は私が私のpom.xml

<plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-dependency-plugin</artifactId> 
    <version>3.0.1</version> 
    <executions> 
     <execution> 
      <id>copy</id> 
      <phase>install</phase> 
      <goals> 
       <goal>copy-dependencies</goal> 
      </goals> 
      <configuration> 
       <outputDirectory> 
        ${project.build.directory}/lib 
       </outputDirectory> 
      </configuration> 
     </execution> 
    </executions> 
</plugin> 

<plugin> 
    <artifactId>maven-assembly-plugin</artifactId> 
    <groupId>org.apache.maven.plugins</groupId> 
    <version>3.1.0</version> 
    <executions> 
     <execution> 
     <id>online-store</id> 
     <phase>package</phase> 
     <goals> 
      <goal>single</goal> 
     </goals> 
     <configuration> 
      <archive> 
       <manifest> 
        <addClasspath>true</addClasspath> 
        <classpathPrefix>lib/</classpathPrefix> 
        <mainClass>com.online.store.Main</mainClass> 
       </manifest> 
      </archive> 
      <appendAssemblyId>false</appendAssemblyId> 
      <descriptors> 
       <descriptor>src/assembly/assembly.xml</descriptor> 
      </descriptors> 
     </configuration> 
     </execution> 
    </executions> 
</plugin> 

の内側に持っているもので、ここで私はassembly.xml

<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> 
    <id>online-store</id> 
    <formats> 
     <format>zip</format> 
    </formats> 
    <includeBaseDirectory>false</includeBaseDirectory> 
    <fileSets> 
     <!-- some file sets --> 
    </fileSets>  
    <dependencySets> 
     <dependencySet> 
     <scope>compile</scope> 
     <includes> 
        <include>*:jar:*</include> 
      </includes> 
     <outputDirectory>/online-store/lib</outputDirectory> 
    </dependencySet> 
    </dependencySets> 
</assembly> 
+0

?アセンブリファイルでは、スコープのもののみが –

+0

を提供していることを示しています。スコープテストです。どのようにスコープを変更してそれらを含めることもできますか? –

+0

スコープtest –

答えて

0

あなたはスコープのテストで別のdependencySetを含むことができ、中に持っているものです。例えば

:含まれていない依存関係を持つスコープ

<assembly> 
    ... 
    <dependencySets> 
     <dependencySet> 
     <scope>compile</scope> 
     <includes> 
       <include>*:jar:*</include> 
      </includes> 
     <outputDirectory>/online-store/lib</outputDirectory> 
    </dependencySet> 
    <dependencySet> 
     <scope>test</scope> 
     <includes> 
       <include>*:jar:*</include> 
      </includes> 
     <outputDirectory>/online-store/lib</outputDirectory> 
    </dependencySet> 
    </dependencySets> 
</assembly> 
+0

Perfectで別の依存関係セットを含めることができます。それが解決策でした –

関連する問題