Using an assembly is fine, but in this case may be unnecessary. First, you need to identify which dependency is requiring the library you are trying to exclude. You can do this using:
mvn dependency:tree The output is an ascii-art style tree which shows all the artifacts in your project. Once you identify the artifact that is forcing the dependency you can add a dependency exclusion in the <dependency> for that artifact. For example: <dependency> <groupId>some-hibernate-dependee.group</groupId> <artifactId>some-hibernate-dependee.artifact</artifactId> <version>2.5.3</version> <scope>compile</scope> <exclusions> <exclusion> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> </exclusion> </exclusions> </dependency> Hope that helps. -Brandon On Sun, Aug 23, 2009 at 3:04 PM, Karan <karan1...@gmail.com> wrote: > Hello, > > I have a case that my web-server(jboss) allready have sertian libs that > dont need to be included (hibernate-annotations) in the war archive. > > 1. So in the pom.xml i set scope to provided on hibernate-annotations, but > this does not help., all the libs comes in WEB-INF/libs > 2. I tried to use assembly plugins with format war, but then the war file > contains the orginal-war(with all dependency) and correct dependency libs > are copied in the root-folder(not the speficied folder (WEB-INF/lib))-> so > this not help either., (i tried to use ) > > > The beste way is when i can specify a profile, for eks., jboss-build and > then build correct war archive without hibernate libs... > > can anybody that have any solutions plz help.. > > > assembly configs (pom.xml) > <plugin> > <artifactId>maven-assembly-plugin</artifactId> > <version>2.1</version> > <configuration> > <descriptors> > <descriptor>src/main/assembly/src.xml</descriptor> > </descriptors> > </configuration> > <executions> > <execution> > <id>make-assembly</id> > <phase>package</phase> > <goals> > <goal>single</goal> > </goals> > </execution> > </executions> > </plugin> > > my src.xml (assembly-descriptor): > > <assembly> > <id>bin</id> > <formats> > <format>war</format> > </formats> > <includeBaseDirectory>false</includeBaseDirectory> > <fileSets> > <fileSet> > <directory>target</directory> > <outputDirectory>/</outputDirectory> > <includes> > <include>application-web-1.0-SNAPSHOT</include> > </includes> > > <excludes><exclude>application-web-1.0-SNAPSHOT/WEB-INF/lib/**</exclude></excludes> > </fileSet> > </fileSets> > > <dependencySets> > > <outputDirectory>application-web-1.0-SNAPSHOT/WEB-INF/lib</outputDirectory> > <dependencySet> > <excludes> > * > <exclude>hibernate-annotations:hibernate-annotations</exclude>* > </excludes> > </dependencySet> > </dependencySets> > </assembly> > > application-web-1.0-SNAPSHOT-bin.war: > /META-INF: > /correct.jar files (why are the placed here when i say > application-web-1.0-SNAPSHOT/WEB-INF/lib?) > application-web-1.0-SNAPSHOT.war <-- with wrong jar files in web-inf/libs > > > Thanx in advance.. > > Regards, > Karan >