I'm not sure how you are using the plugin, but your pom.xml should read like, 


<project>
  <parent>
    <groupId>ce.demo</groupId>
    <artifactId>demo</artifactId>
    <version>1.0-SNAPSHOT</version>
 </parent>

 <modelVersion>4.0.0</modelVersion>
 <groupId>ce.demo</groupId>
 <artifactId>webapp</artifactId>
 <packaging>war</packaging>
 <name>Web Application Project</name>
 <dependencies>
  <dependency>
    <groupId>ce.demo</groupId>
    <artifactId>app</artifactId>
    <version>${project.version}</version>
  </dependency>
  <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.4</version>
  </dependency>
  <dependency> 
    <groupId>commons-configuration</groupId>
    <artifactId>commons-configuration</artifactId>
    <version>1.2</version>
    <exclusions>
      <exclusion>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
      </exclusion>
   </exclusions>
  </dependency>
  </dependencies>

  <build>
   <plugins>
    <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-war-plugin</artifactId> 
     <version>2.0.1</version> 
     <configuration> 
         <warSourceExcludes> 
         </warSourceExcludes> 
     </configuration> 
    </plugin>   
   </plugins>
  </build>

</project>

Do note that the plugin version is 2.0.1




jiangshachina wrote:
> 
> Hi,
> I used the following scripts(for example, I didn't want dom4j-1.4.jar),
> and had a success.
> <dependency>
>       <dependency>
>               <groupId>commons-configuration</groupId>
>               <artifactId>commons-configuration</artifactId>
>               <version>1.2</version>
>               <exclusions>
>                       <exclusion>
>                               <groupId>dom4j</groupId>
>                               <artifactId>dom4j</artifactId>
>                       </exclusion>
>               </exclusions>
>       </dependency>
> </dependency>
> 
> but didn't get same result with following scripts,
> <build>
>       <plugins>
>               <plugin>
>                       <groupId>org.apache.maven.plugins</groupId>
>                       <artifactId>maven-war-plugin</artifactId>
>                       <version>2.0.1</version>
>                       <configuration>
>                               <warSourceExcludes>
>                                       WEB-INF/lib/dom4j-1.4.jar
>                               </warSourceExcludes>
>                       </configuration>
>               </plugin>
>       </plugins>
> </build>
> And I don't find parameter "warSourceExcludes" at maven-war-plugin doc
> http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html
> I also don't find "warSourceExcludes" at link
> http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html
> 
> Dmystery, you said all is ok in your project.
> Can you show your case briefly?
> My pom.xml is very simple, following is the all
> <project>
>       <parent>
>               <groupId>ce.demo</groupId>
>               <artifactId>demo</artifactId>
>               <version>1.0-SNAPSHOT</version>
>       </parent>
> 
>       <modelVersion>4.0.0</modelVersion>
>       <groupId>ce.demo</groupId>
>       <artifactId>webapp</artifactId>
>       <packaging>war</packaging>
>       <name>Web Application Project</name>
> 
>       <dependencies>
>               <dependency>
>                       <groupId>ce.demo</groupId>
>                       <artifactId>app</artifactId>
>                       <version>${project.version}</version>
>               </dependency>
>               <dependency>
>                       <groupId>javax.servlet</groupId>
>                       <artifactId>servlet-api</artifactId>
>                       <version>2.4</version>
>               </dependency>
>               <dependency>
>                       <groupId>commons-configuration</groupId>
>                       <artifactId>commons-configuration</artifactId>
>                       <version>1.2</version>
>                       <exclusions>
>                               <exclusion>
>                                       <groupId>dom4j</groupId>
>                                       <artifactId>dom4j</artifactId>
>                               </exclusion>
>                       </exclusions>
>               </dependency>
>       </dependencies>
> </project>
> 
> a cup of Java, cheers!
> Sha Jiang
> 
> 
> struberg wrote:
>> 
>> there is a syntax to exclude some transitive
>> dependencies from the dependency-list:
>> 
>> a small sample:
>>     <dependency>
>>       <groupId>avalon-framework</groupId>
>>       <artifactId>avalon-framework-api</artifactId>
>>       <version>4.3</version>
>>       <exclusions>
>>         <exclusion>
>>           <groupId>avalon-logkit</groupId>
>>           <artifactId>avalon-logkit</artifactId>
>>         </exclusion>
>>       </exclusions>
>>     </dependency>
>> 
>> I guess this may solve your problems.
>> 
>> best regards,
>> strub
>> 
>> --- Dmystery <[EMAIL PROTECTED]> schrieb:
>> 
>>> 
>>> This should definitely remove all the unwanted
>>> dependencies. Even if they are
>>> dependencies of a dependency. I'm doing the same
>>> thing to remove all the
>>> unwanted files. 
>>> Can you post your pom.xml?
>>> 
>>> jiangshachina wrote:
>>> > 
>>> > Hi Dmystery,
>>> > Thanks for your help.
>>> > 
>>> > I'm sorry that I cannot success with your
>>> instructions.
>>> > And I also read the guide on maven-war-plugin,
>>> especially at
>>> >
>>>
>> http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html
>>> > Unfortunately, I don't find the answer.
>>> > 
>>> > The guide is on how to add or filter resources
>>> from standard/customized
>>> > resource paths.
>>> > But it's not on how to filter resources from the
>>> dependencies of
>>> > dependencies.
>>> > 
>>> > a cup of Java, cheers!
>>> > Sha Jiang
>>> > 
>>> > 
>>> > Dmystery wrote:
>>> >> 
>>> >> Use maven-war-plugin. Due to transitive
>>> dependencies in M2, you need to
>>> >> remove them using the <warSourceExcludes> tag in
>>> the plugin as below.
>>> >> 
>>> >>   <build>
>>> >>    <plugins>
>>> >>     <plugin> 
>>> >>      <groupId>org.apache.maven.plugins</groupId> 
>>> >>      <artifactId>maven-war-plugin</artifactId> 
>>> >>      <version>2.0.1</version> 
>>> >>      <configuration> 
>>> >>   <warSourceExcludes> 
>>> >>          WEB-INF/lib/jar1,WEB-INF/lib/jar2,
>>> >>          </warSourceExcludes> 
>>> >>      </configuration> 
>>> >>     </plugin>   
>>> >>    </plugins>
>>> >>   </build>
>>> >> 
>>> >> Checkout :
>>>
>> http://maven.apache.org/plugins/maven-war-plugin/index.html
>>> >> 
>>> >> 
>>> >> jiangshachina wrote:
>>> >>> 
>>> >>> I have another question.
>>> >>> In Web application project, generally, class
>>> files would be located at
>>> >>> WEB-INF/classes.
>>> >>> But now, I want they to be archived, and locate
>>> at WEB-INF/lib.
>>> >>> 
>>> >>> And I want the jars could be put into different
>>> sub-directory under
>>> >>> WEB-INF/lib?
>>> >>> 
>>> >>> maven-jar-plugin or maven-war-plugin can help
>>> me?
>>> >>> How can I do?
>>> >>> 
>>> >>> 
>>> >>> jiangshachina wrote:
>>> >>>> 
>>> >>>> Hello,
>>> >>>> My web projects needs Apache
>>> commons-configuration.
>>> >>>> I added commons-configuration to my dependency.
>>> >>>> After run "mvn package", too many jar files
>>> were added into WEB-INF/lib
>>> >>>> directory.
>>> >>>> But I found many jars(e.g. xalan-2.7.0.jar) out
>>> of the list, which
>>> >>>> lists commons-configuration's runtime
>>> dependencies, shown at home of
>>> >>>> commons-collections.
>>> >>>> In commons-configuration-1.2.pom, so many
>>> dependencies are added.
>>> >>>> 
>>> >>>> How to cancel the trouble?
>>> >>>> 
>>> >>>> a cup of Java, cheers!
>>> >>>> Sha Jiang 
>>> >>>> 
>>> >>> 
>>> >>> 
>>> >> 
>>> >> 
>>> > 
>>> > 
>>> 
>>> -- 
>>> View this message in context:
>>>
>> http://www.nabble.com/Too-many-jars-added-to-lib--tf2558368s177.html#a7131903
>>> Sent from the Maven - Users mailing list archive at
>>> Nabble.com.
>>> 
>>> 
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:
>>> [EMAIL PROTECTED]
>>> For additional commands, e-mail:
>>> [EMAIL PROTECTED]
>>> 
>>> 
>> 
>> 
>> 
>>              
>> ___________________________________________________________ 
>> Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Too-many-jars-added-to-lib--tf2558368s177.html#a7151398
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to