2016-12-21 7 views
0

私はいくつかのモジュールをmavenに持っており、他のモジュールの依存関係を持つモジュールのjarをビルドしたいと思います。他のモジュールからの依存関係を持つmavenのモジュールからjarをビルドするには?

どのようにして両方のモジュールにjarを含めることができますか?

編集:

私は以下のモジュールがあります。

myproject-core/ 
    myproject-api/ 
    myproject-dependencie/ 
    myproject-api-web/ 

をそして私はmyprojectに-dependencieでmyprojectに-APIのjarファイルを構築したいです。私はmyproject-apiにもっと依存しているので、myproject-apiとmyproject-dependencieというmyproject-jaというこのjarファイルだけが必要です。

ありがとうございます!

+0

あなたがここで何をしたいのか不明です。あなたが持っているものを明確にすることができますか?おそらく助けになるいくつかのサンプルPOMを投稿できますか? – Tunaki

+0

私は詳細を編集しました、ありがとう –

答えて

1

私はMavenのシェード - プラグインがあなたの友人になります推測:

あなたに

https://maven.apache.org/plugins/maven-shade-plugin/

プラグインセクションような何か:

...

<properties> 
     <shade-main-class>{your-main-class}</shade-main-class> 
    </properties> 

...

...

  <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-shade-plugin</artifactId> 
       <version>2.4.3</version> 
       <configuration> 
        <createDependencyReducedPom>false</createDependencyReducedPom> 
        <filters> 
         <filter> 
          <artifact>*:*</artifact> 
      <includes> 
       <include>com/yourcompany/**</include> 
       </includes> 
          <excludes> 
           <exclude>META-INF/*.SF</exclude> 
           <exclude>META-INF/*.DSA</exclude> 
           <exclude>META-INF/*.RSA</exclude> 
          </excludes> 
         </filter> 
        </filters> 
       </configuration> 
       <executions> 
        <execution> 
         <phase>package</phase> 
         <goals> 
          <goal>shade</goal> 
         </goals> 
         <configuration> 
          <transformers> 
           <transformer 
            implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> 
           <transformer 
            implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 
            <mainClass>${shade-main-class}</mainClass> 
           </transformer> 
          </transformers> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
... 
+0

こんにちはthelINtoy、このコードで、私はすべての依存関係を持つjarファイルを取得すると思いますが、私はそれらのうちの1つを必要とするすべての依存関係を望んでいません。 –

+0

私は除外タグを使って残りの依存関係を除外することができると思います...しかし、私は静かに多く、私は他の方法を探しています... –

+0

あなたの質問を編集した後、フィルターを含める – theINtoy

関連する問題