2011-10-18 36 views
0

我有使用Maven構建.war文件的問題。行家不考慮改變POM文件

我有一個具有提供的範圍上項目的POM的依賴。

當我第一次嘗試在我的項目上運行「包」目標時,maven不會將 插入到最終的.war文件中。

正如我預期的那樣,當我從POM中刪除提供的範圍時,maven在最終的.war文件中包含依賴的 jar文件(在此之前它是正確的)。

,但是當我的依賴重新設置提供範圍,行家還包括war包依賴的jar文件。!

我曾嘗試清潔:清潔目標,也是更新快照開關 ,但它還是會出錯。

它是一個錯誤嗎?或者我必須做一些配置來避免這種情況。

我使用的Maven 3.0.3

這是POM:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>testmaven</groupId> 
    <artifactId>testmaven</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>war</packaging> 
    <name/> 
    <description/> 
    <dependencies> 
    <dependency> 
      <groupId>com.pardis.communicationcenter</groupId> 
      <artifactId>communicationCenterCommon</artifactId> 
      <version>1.0</version> 
      <type>jar</type> 
     </dependency> 
     <dependency> 
      <groupId>com.pardis.communicationcenter</groupId> 
      <artifactId>communicationCenterWSCommon</artifactId> 
      <version>1.0</version> 
      <type>jar</type> 
     </dependency> 
     <dependency> 
      <groupId>com.pardis.parameterengine</groupId> 
      <artifactId>parameterenginecommon</artifactId> 
      <version>1.0</version> 
      <type>jar</type> 
     </dependency> 
      <dependency> 
      <groupId>com.bea.weblogic</groupId> 
      <artifactId>weblogic</artifactId> 
      <version>1.0</version> 
      <type>jar</type> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.thoughtworks.xstream</groupId> 
      <artifactId>xstream</artifactId> 
      <version>1.3.1</version> 
     </dependency> 

     <dependency> 
      <groupId>javaee</groupId> 
      <artifactId>javaee-api</artifactId> 
      <scope>provided</scope> 
      <version>5</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.velocity</groupId> 
      <artifactId>velocity</artifactId> 
      <version>1.5</version> 
     </dependency> 
     <dependency> 
      <groupId>com.pardis.common</groupId> 
      <artifactId>fanavaCommon</artifactId> 
      <version>1.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.pardis.retail.common</groupId> 
      <artifactId>rtlmgrCommon</artifactId> 
      <version>1.0</version> 
     </dependency> 

     <dependency> 
      <groupId>com.pardis.retail.common</groupId> 
      <artifactId>rtlmgrFast</artifactId> 
      <version>1.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.pardis.job</groupId> 
      <artifactId>jobschedulingclient</artifactId> 
      <version>1.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.pardis.security</groupId> 
      <artifactId>pincoding</artifactId> 
      <version>1.0</version> 
     </dependency> 

     <dependency> 
      <groupId>com.pardis.workflowengine</groupId> 
      <artifactId>workflowenginegclient</artifactId> 
      <version>1.0</version> 
      <type>jar</type> 
     </dependency> 

     <dependency> 
      <groupId>com.pardis.genericmanagedbean</groupId> 
      <artifactId>genericManagedBeanCommon</artifactId> 
      <version>1.0</version> 
      <type>jar</type> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.myfaces.tomahawk</groupId> 
      <artifactId>tomahawk</artifactId> 
      <version>1.1.9</version> 
     </dependency> 
     <dependency> 
      <groupId>com.pardis.common</groupId> 
      <artifactId>SAD</artifactId> 
      <version>1.6</version> 
      <type>jar</type> 
     </dependency> 
     <dependency> 
      <groupId>com.pardis.common</groupId> 
      <artifactId>accountDataProviderCommon</artifactId> 
      <version>1.0</version> 
      <type>jar</type> 
     </dependency> 
     <dependency> 
      <groupId>com.pardis.common</groupId> 
      <artifactId>personDataProviderCommon</artifactId> 
      <version>1.0</version> 
      <type>jar</type> 
     </dependency> 
     <dependency> 
      <groupId>com.pardis.bank</groupId> 
      <artifactId>BankBusiness</artifactId> 
      <version>1.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.myfaces.core</groupId> 
      <artifactId>myfaces-impl</artifactId> 
      <version>1.2.7</version> 
     </dependency> 

     <dependency> 
      <groupId>com.pardis.batch</groupId> 
      <artifactId>batchwebserviceclient</artifactId> 
      <version>1.0</version> 
     </dependency> 

<dependency> 
    <groupId>com.pardis.security</groupId> 
    <artifactId>usermanagerclient</artifactId> 
    <version>1.0</version> 
    <type>jar</type> 
</dependency> 

<dependency> 
    <groupId>com.pardis.cardmanager</groupId> 
    <artifactId>crdmgrCommon</artifactId> 
    <version>1.0</version> 
</dependency> 
    </dependencies> 
    <build> 
    <sourceDirectory>${basedir}/src</sourceDirectory> 
    <outputDirectory>${basedir}/WebRoot/WEB-INF/classes</outputDirectory> 
    <resources> 
     <resource> 
     <directory>${basedir}/src</directory> 
     <excludes> 
      <exclude>**/*.java</exclude> 
     </excludes> 
     </resource> 
    </resources> 
    <plugins> 
     <plugin> 
     <artifactId>maven-war-plugin</artifactId> 
     <configuration> 
      <webappDirectory>${basedir}/WebRoot</webappDirectory> 
      <warSourceDirectory>${basedir}/WebRoot</warSourceDirectory> 
     </configuration> 
     </plugin> 
     <plugin> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <configuration> 
      <source>1.6</source> 
      <target>1.6</target> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
</project> 

問題是關於:

 <dependency> 
      <groupId>com.bea.weblogic</groupId> 
      <artifactId>weblogic</artifactId> 
      <version>1.0</version> 
      <type>jar</type> 
      <scope>provided</scope> 
     </dependency> 

在此先感謝

回答

1

哪個戰爭是你看着?運行mvn clean package將在目標目錄中構建一場新的戰爭,並且戰爭將不會有任何依賴關係,其範圍爲provided

+0

我已經測試過,但它並沒有解決我的問題 – arash

+0

即使我刪除了其他依賴關係,並再次運行包的目標,但行家還是把所有相關的jar文件歸檔的戰爭!它有什麼問題? – arash

+0

當我改變文件的物理路徑時,每件事似乎都OK! – arash