2010-05-11 67 views

回答

1

我不知道理解爲什麼你需要做的,但我看到兩個點這裏:

  1. 避免依賴於被複制到WEB-INF/lib(如果沒有,那麼就跳過相關的1部分。 )
  2. 將它們複製到另一個目錄。

對於1,我假設你需要的依賴關係(因爲要編譯對他們的),但如果你不希望Maven的戰爭插件在WEB-INF/lib它們複製,你必須玩他們的scope,例如通過聲明他們提供。

對於2. Maven的依賴插件將在這裏有所幫助,我想你可以使用dependency:copy-dependencies,例如在pre-package階段。像這樣使用它:

<project> 
    [...] 
    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-dependency-plugin</artifactId> 
     <executions> 
      <execution> 
      <id>copy-dependencies</id> 
      <phase>pre-package</phase> 
      <goals> 
       <goal>copy-dependencies</goal> 
      </goals> 
      <configuration> 
       <!-- configure the plugin here --> 
      </configuration> 
      </execution> 
     </executions> 
     </plugin> 
    </plugins> 
    </build> 
    [...] 
</project> 

並配置outputDirectory(和其他您可能需要的參數)。

+0

「預包裝」應該是「預包裝」 – pstanton 2014-11-14 02:14:17