簡體   English   中英

在多模塊項目上構建一個“輕型”jar

[英]Build a “light” jar on multi-module project

我有一個多模塊項目,我用匯編插件組裝到一個胖罐子里。 感謝到目前為止工作正常,但現在我想構建另一個jar,它只包含uber-pom依賴項的特殊包。

一個例子:

我在子項目上有3個deps,我想要一個罐子

  • com.mycompany.api。*,
  • com.mycompany.settings。*
  • com.mycompany.public。*

但不是

  • com.mycompany.internal。*

這些包通過3個分發。

有沒有機會用匯編插件實現類似的東西?

謝謝,Jan

Shade插件應該可以做類似的事情。

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.0</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <includes>
                    <include>com/mycompany/api/*</include>
                    <include>com/mycompany/settings/*</include>
                    <include>com/mycompany/public/*</include>
                  </includes>
                </filter>
              </filters>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM