|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
how to avoid sertin libs in warHello,
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 |
|
|
Re: how to avoid sertin libs in warUsing 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 <karan1980@...> wrote:
|
|
|
Re: how to avoid sertin libs in war
Hello Karan,
your first solution (scope provided) should work. Here a link to the manuals (last paragraph): http://maven.apache.org/plugins/maven-war-plugin/examples/war-manifest-guide.html <dependencies>
<dependency>
<groupId>org.foo</groupId>
<artifactId>bar-jar1</artifactId>
<version>${pom.version}</version>
<optional>true</optional>
<!-- goes in manifest classpath, but not included in WEB-INF/lib -->
</dependency>
<dependency>
<groupId>org.foo</groupId>
<artifactId>bar-jar2</artifactId>
<version>${pom.version}</version>
<!-- goes in manifest classpath, AND included in WEB-INF/lib -->
</dependency>
<dependency>
<groupId>org.foo</groupId>
<artifactId>bar-jar3</artifactId>
<version>${pom.version}</version>
<scope>provided</scope>
<!-- excluded from manifest classpath, and excluded from WEB-INF/lib -->
</dependency>
...
</dependencies>
Try again with scope provided. Have you done a 'mvn clean' before
testing your first solution to get rid of caching effects? Use 'mvn dependency:tree' to check the dependencies and their writings. Regards Gerd Brandon Atkinson schrieb: Using an assembly is fine, but in this case may be unnecessary. [gaschbrenner.vcf] begin:vcard fn:Gerd Aschbrenner n:Aschbrenner;Gerd org:Picturesafe GmbH;Softwareentwicklung adr:;;Simon-von-Utrecht-Strasse 31-37;Hamburg;Hamburg;20359;Germany email;internet:gaschbrenner@... title:Dipl. -Ing. tel;work:+49 40 374127 903 tel;fax:+49 40 374127 999 note;quoted-printable:Sitz der Gesellschaft: Hannover=0D=0A= Gesch=C3=A4ftsf=C3=BChrer: Herbert Wirth=0D=0A= HR: Amtsgericht Hannover HR B 53 366 x-mozilla-html:FALSE url:http://www.picturesafe.de version:2.1 end:vcard --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: how to avoid sertin libs in warHi Brandon & Gerd!
Thank you for yours replaies.. I can do that but there should be possible to build war archive for sertin different web-servers., in my case the web-server that i run have allready thease libs so i had to exclude, its not the best solution when you have to comment out for some dependency to build a war for jboss and the edit pom file to make war for another server.. I think using different profiles may help.. one for jetty and one for jboss(without excludes on hibernate jars). and i also ended up divideding my war-pom to two different one jar-pom and war-pom so that i didnt have any source code in war-pom. Regards Karan 2009/8/25 Gerd Aschbrenner <gaschbrenner@...>
|
| Free embeddable forum powered by Nabble | Forum Help |