我的maven内置.war文件有问题。
我依赖项目的POM,它具有提供的范围。
当我第一次尝试在我的项目上运行“包”目标时,maven没有 将依赖的jar文件插入最终的.war文件中。
正如我所料,当我从POM中删除提供的范围时,maven包含依赖 最终的.war文件中的jar文件(在此之前它是正确的。)
但是当我再次设置依赖关系的范围时,maven仍然包含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>
提前致谢
答案 0 :(得分:1)
mvn clean package
将在目标目录中构建一个新的战争,并且该战争在其范围为provided
的情况下不会有任何依赖。