arash
arash

Reputation: 967

maven does not consider changed pom file

i have a problem with maven built .war file.

i have a dependency on project's POM which has the provided scope.

when for first time i try to run "package" goal on my project, maven does not insert dependent jar file into final .war file.

and as i expected, when i remove the provided scope form the POM, maven includes dependent jar file on final .war file (it is correct until this point).

but when i set provided scope for dependency again, maven still includes the dependent jar file in war package.!!!

i have tried clean:clean goal and also update snapshot switch but it still goes wrong.

is it a bug? or i must do some configuration to avoid this.

i am using maven 3.0.3

this is 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>

problem is about:

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

thanks in advance

Upvotes: 0

Views: 208

Answers (1)

Ryan Stewart
Ryan Stewart

Reputation: 128829

Which war are you looking at? Running mvn clean package will build a new war in your target directory, and that war won't have any dependency in it whose scope is provided.

Upvotes: 1

Related Questions