Finally it worked ! :) (thanks Alexander!) Summarizing:
in order to create an executable JAR file that will depend on other libraries/jars from other internal project or external without including them inside the JAR's project: 1. use maven jar plugin to define the mail class in the manifest: 2. use maven dependency plugin to copy the dependencies to your classpath. one last thing, how to i tell the pom to copy the executable jar to it's target dir (e.g. /usr/local/bin). i can do it with copy-resources, but i don't think it was meant for it.. here's the full pom.xml: <?xml version="1.0" encoding="utf-8"?> <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>com.company.url.unknowns</groupId> <artifactId>IncreasePriority</artifactId> <packaging>jar</packaging> <version>1.00.0000</version> <name>IncreasePriority</name> <url>http://maven.apache.org</url> <organization> <name>company</name> <url>http://www.company.com</url> </organization> <developers> <developer> <id>${env.USER}</id> <name>${user.name}</name> <email>${env.us...@company.com <env.user...@company.com></email> <organization>company</organization> <organizationUrl>http://www.company.com</organizationUrl> <roles> <role>developer</role> </roles> <timezone>+2</timezone> </developer> </developers> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>/usr/lib/company/java</outputDirectory> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>false</overWriteSnapshots> <overWriteIfNewer>true</overWriteIfNewer> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.4.1</version> <executions> <execution> <id>copy-conf</id> <phase>install</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>/etc/ct-urlf-increase-priority/</outputDirectory> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>**/*.properties</include> </includes> </resource> </resources> </configuration> </execution> <execution> <id>copy-cron</id> <phase>install</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>/etc/cron.d/</outputDirectory> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>**/*.cron</include> </includes> </resource> </resources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>com.company.url.unknowns.IncreasePriority</mainClass> <addClasspath>true</addClasspath> <classpathPrefix>/usr/lib/company/java</classpathPrefix> </manifest> </archive> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <version>2.4</version> </plugin> </plugins> <finalName>${project.groupId}-${project.artifactId}</finalName> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4.1</version> </dependency> <dependency> <groupId>com.company.file.IniFile</groupId> <artifactId>IniFile</artifactId> <version>1.00.0000</version> </dependency> <dependency> <groupId>com.company.sql.DbUtil</groupId> <artifactId>DbUtil</artifactId> <version>1.00.0001</version> </dependency> </dependencies> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <repositories> <repository> <id>company</id> <url>http://localhost:8081/nexus/content/repositories/company/</url> </repository> </repositories> <distributionManagement> <repository> <id>company</id> <name>company Maven Repository</name> <url>file://localhost/home/eyale/sonatype-work/nexus/storage/company/</url> </repository> </distributionManagement> </project> On Tue, Nov 17, 2009 at 8:33 PM, Alexander <the.malk...@gmail.com> wrote: > Question was how make executable jar without including all dependencies in > application jar but in separate folder. > > 2009/11/18 Brian Fox <bri...@infinity.nu> > > > > > > http://www.sonatype.com/people/2009/08/how-to-make-an-executable-jar-in-maven/ > > > > On Tue, Nov 17, 2009 at 1:12 PM, eyal edri <eyal.e...@gmail.com> wrote: > > > i will, once i get to work tomorrow :) > > > > > > thanks for the help. > > > > > > On Tue, Nov 17, 2009 at 8:05 PM, Alexander <the.malk...@gmail.com> > > wrote: > > > > > >> Dont be shy, just try it. > > >> > > >> 2009/11/17 eyal edri <eyal.e...@gmail.com> > > >> > > >> > can i use the 'dependency:copy-dependencies< > > >> > > > >> > > > http://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html > > >> > >' > > >> > goal in this project to tell it to copy all it's > > >> > dependencies to the "lib" dir? > > >> > like shown in here: > > >> > > > >> > > > >> > <build> > > >> > <plugins> > > >> > <plugin> > > >> > <groupId>org.apache.maven.plugins</groupId> > > >> > <artifactId>maven-dependency-plugin</artifactId> > > >> > <executions> > > >> > <execution> > > >> > <id>copy-dependencies</id> > > >> > <phase>package</phase> > > >> > <goals> > > >> > <goal>copy-dependencies</goal> > > >> > </goals> > > >> > <configuration> > > >> > <outputDirectory>/usr/local/app</outputDirectory> > > >> > <overWriteReleases>false</overWriteReleases> > > >> > <overWriteSnapshots>false</overWriteSnapshots> > > >> > <overWriteIfNewer>true</overWriteIfNewer> > > >> > </configuration> > > >> > </execution> > > >> > </executions> > > >> > </plugin> > > >> > </plugins> > > >> > </build> > > >> > > > >> > > > >> > > > >> > btw: (when you said <classpathPrefix>*lib*</classpathPrefix>, > > >> > > > >> > does this means "projectHome/lib" is the classPath?) > > >> > > > >> > > > >> > On Tue, Nov 17, 2009 at 4:51 PM, Alexander <the.malk...@gmail.com> > > >> wrote: > > >> > > > >> > > You could do this without assembly plugin. > > >> > > > > >> > > Just copy all dependencies with maven-dependency-plugin to some > > folder > > >> > and > > >> > > than add this folder as classpath prefix in maven-jar-plugin. > > >> > > > > >> > > example for second part > > >> > > > > >> > > <plugin> > > >> > > <artifactId>maven-jar-plugin</artifactId> > > >> > > <configuration> > > >> > > <archive> > > >> > > <manifest> > > >> > > <mainClass>you.main.class</mainClass> > > >> > > <addClasspath>true</addClasspath> > > >> > > <classpathPrefix>lib</classpathPrefix> > > >> > > </manifest> > > >> > > </archive> > > >> > > </configuration> > > >> > > </plugin> > > >> > > > > >> > > 2009/11/17 eyal edri <eyal.e...@gmail.com> > > >> > > > > >> > > > Hi, > > >> > > > > > >> > > > i'm trying to figure out how can i create a working executable > JAR > > >> that > > >> > > has > > >> > > > dependencies > > >> > > > (in-house maven projects plus external lib such as Log4J). > > >> > > > > > >> > > > I tried using the assembly plugin by creating a > > >> > "jar-with-dependencies". > > >> > > > > > >> > > > but this creates a big JAR with all the dependencies included. > > >> > > > > > >> > > > I want to be able to install commons dependencies in a commons > > >> > directory > > >> > > > (/usr/lib/maven-projects/ for e.g.), > > >> > > > and that every project that depends on them can use them. > > >> > > > > > >> > > > What should i do in the pom file of the infrastructure project > and > > >> the > > >> > > > project that depends on it? > > >> > > > > > >> > > > i've read almost all the complete "maven-definite-guide", but > > didn't > > >> > find > > >> > > a > > >> > > > concise answer... > > >> > > > > > >> > > > thanks, > > >> > > > -- > > >> > > > Eyal Edri > > >> > > > > > >> > > > > >> > > > > >> > > > > >> > > -- > > >> > > Regards, > > >> > > Alexander > > >> > > > > >> > > > >> > > > >> > > > >> > -- > > >> > Eyal Edri > > >> > > > >> > > >> > > >> > > >> -- > > >> Regards, > > >> Alexander > > >> > > > > > > > > > > > > -- > > > Eyal Edri > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > > For additional commands, e-mail: users-h...@maven.apache.org > > > > > > > -- > Regards, > Alexander > -- Eyal Edri