2016-04-26 46 views
0

我有我的POM依賴:排除從Maven的依賴(webjars)資源包

<dependency> 
    <groupId>org.webjars</groupId> 
    <artifactId>extjs</artifactId> 
    <version>6.0.0</version> 
</dependency> 

建立我的項目到戰爭結束後,我收到了擁有200MB包。 有沒有可能排除包

/webjars/extjs/6.0.0/build/examples/ 

從這個依賴?我怎樣才能做到這一點?

我試圖使用遮陽插件,但它不工作,也是在戰爭插件配置:

<configuration> 
    <packagingExcludes> 
     /webjars/extjs/${extjs.version}/build/examples/ 
    </packagingExcludes> 
</configuration> 

不起作用。

回答

0

請看看this頁面。它討論如何通過排除不必要的內容來縮小webjar。

0

由於Dark Knight我發現對我的作品的解決方案:

<dependency> 
     <groupId>org.webjars</groupId> 
     <artifactId>extjs</artifactId> 
     <version>${extjs.version}</version> 
     <scope>provided</scope> 
    </dependency> 
... 

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <version>2.6</version> 
      <configuration> 
       <archive> 
        <manifest> 
         <addClasspath>true</addClasspath> 
         <addDefaultImplementationEntries>true</addDefaultImplementationEntries> 
         <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> 
        </manifest> 
       </archive> 
       <webResources> 
        <resource> 
         <directory>${project.build.directory}\extjs\META-INF\resources</directory> 
        </resource> 
       </webResources> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-dependency-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>unpack-jar</id> 
        <phase>generate-resources</phase> 
        <goals> 
         <goal>unpack</goal> 
        </goals> 
        <configuration> 
         <artifactItems> 
          <artifactItem> 
           <groupId>org.webjars</groupId> 
           <artifactId>extjs</artifactId> 
           <version>${extjs.version}</version> 
           <type>jar</type> 
           <destFileName>extjs-dependency</destFileName> 
           <includes> 
            META-INF/resources/webjars/extjs/${extjs.version}/build/*.*, 
            META-INF/resources/webjars/extjs/${extjs.version}/build/classic/**/*.*, 
            META-INF/resources/webjars/extjs/${extjs.version}/build/packages/**/*.* 
           </includes> 
           <outputDirectory> 
            ${project.build.directory}/extjs 
           </outputDirectory> 
          </artifactItem> 
         </artifactItems> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin>