wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes exclude an external jar while building my application - Maven. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "exclude an external jar while building my application - Maven." Watch "exclude an external jar while building my application - Maven." New topic
Author

exclude an external jar while building my application - Maven.

Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

Hi All,

Lets say I have a jar named "A.jar" which is a freesource library and I include it in my pom.xml dependencies while development, and then, when I build my application "jar", it extracts all the jars to a common place and builds MyApp.jar.

My requirement is, I want the A.jar to be there while development, but when I build the MyApp.jar I should be able to exclude A.jar from the build, as I will be putting the A.jar in my servers classpath, while execution. I dont need it again in my MyApp.jar.

Any ideas ?

Thanks in advance... !


Time is what we want the most, but what we use the worst. -- William Penn
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

<dependency>
<groupId>jar</groupId>
<artifactId>id</artifactId>
<version>0.00</version>
<scope>provided</scope>
</dependency>

I did some more googling and this Works!, the scope "provided" stops the jar from getting included in the build , nevermind thanks !
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

That is indeed correct, well done on finding the answer!


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: exclude an external jar while building my application - Maven.
 
Similar Threads
merge multiple jars into one jar?
Problem packaging my app as jar file
Problem signing executable jar's
Jar - Manifest.mf - Class-Path Attribute
Jnlp cannot find the main class in a Jar packaged using "OneJar".