Hi, Anders. Thank you again. I think this example works with older plugin's versions, because it is very like the one I used with Maven 2.2.1. I searched google and read all documentation in the plugin's site before asking, and, as I could not resolve the issue, I am trying the mailing list.
Kind regards, QL On Wed, Apr 18, 2012 at 4:43 AM, Anders Hammar <[email protected]> wrote: > I get several hits with Google. For example: > > > http://www.sonatype.com/people/2009/08/how-to-make-an-executable-jar-in-maven/ > (this one does not talk about useProjectArtifact=false, so I guess it > is not necessary) > > If someone has a real example with a link, please provide. I don't. > > /Anders > > On Wed, Apr 18, 2012 at 00:23, QL 983 <[email protected]> wrote: > > Hi, Anders; thank you for your answer! I tried using useProjectArtifact > > false, but it did not work. > > > > Could you please supply me with an example of a executable > > jar-with-dependencies? > > > > Kind regards, > > > > QL > > > > On Tue, Apr 17, 2012 at 8:06 AM, Anders Hammar <[email protected]> > wrote: > > > >> I think the solution is to set useProjectArtifact to false in the > >> assembly descriptor. > >> > >> /Anders > >> > >> On Tue, Apr 17, 2012 at 11:44, QL 983 <[email protected]> wrote: > >> > Hi. > >> > > >> > I am writing a little tutorial in my company about the use of the > Maven > >> > Assembly Plugin to build a executable jar, with all dependencies > inside > >> it. > >> > > >> > When I was using Maven 2.2.1, the following would done the job: > >> > > >> > ... > >> > <build> > >> > <plugins> > >> > ... > >> > <plugin> > >> > <artifactId>maven-assembly-plugin</artifactId> > >> > <configuration> > >> > <source>1.5</source> > >> > <target>1.5</target> > >> > <archive> > >> > <manifest> > >> > <mainClass>com.company.classX</mainClass> > >> > </manifest> > >> > </archive> > >> > <descriptorRefs> > >> > <descriptorRef>jar-with-dependencies</descriptorRef> > >> > </descriptorRefs> > >> > </configuration> > >> > </plugin> > >> > ... > >> > </plugins> > >> > </build> > >> > ... > >> > > >> > > >> > This time, however, I am using Maven 3.0.4, and I am getting this > >> warning: > >> > > >> > > >> > [WARNING] Cannot include project artifact: com.company.class; it > doesn't > >> > have an associated file or directory. > >> > > >> > > >> > I read the plugin's documentation, but could not figure what is the > >> problem. > >> > > >> > Here is the complete pom I am using now: > >> > > >> > > >> > <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/xsd/maven-4.0.0.xsd"> > >> > <modelVersion>4.0.0</modelVersion> > >> > <groupId>com.company</groupId> > >> > <artifactId>tutorial</artifactId> > >> > <version>1.0-SNAPSHOT</version> > >> > <packaging>jar</packaging> > >> > <name>someName</name> > >> > <url>http://maven.apache.org</url> > >> > <properties> > >> > <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> > >> > <compileSource>1.6</compileSource> > >> > </properties> > >> > <build> > >> > <plugins> > >> > <plugin> > >> > <artifactId>maven-compiler-plugin</artifactId> > >> > <version>2.0.2</version> > >> > <configuration> > >> > <source>${compileSource}</source> > >> > <target>${compileSource}</target> > >> > </configuration> > >> > </plugin> > >> > > >> > <plugin> > >> > <artifactId>maven-assembly-plugin</artifactId> > >> > <version>2.3</version> > >> > <configuration> > >> > > >> > <archive> > >> > <manifest> > >> > <mainClass>com.company.classX</mainClass> > >> > </manifest> > >> > </archive> > >> > <descriptorRefs> > >> > <descriptorRef>jar-with-dependencies</descriptorRef> > >> > </descriptorRefs> > >> > </configuration> > >> > <executions> > >> > <execution> > >> > <id>make-assembly</id> <!-- this is used for inheritance > >> merges > >> > --> > >> > <phase>package</phase> <!-- bind to the packaging phase --> > >> > <goals> > >> > <goal>single</goal> > >> > </goals> > >> > </execution> > >> > </executions> > >> > </plugin> > >> > > >> > </plugins> > >> > </build> > >> > > >> > <dependencies> > >> > > >> > <dependency> > >> > <groupId>org.apache.httpcomponents</groupId> > >> > <artifactId>httpclient</artifactId> > >> > <version>4.1.3</version> > >> > </dependency> > >> > > >> > </dependencies> > >> > > >> > </project> > >> > > >> > > >> > The resulting jar contains httpclient and all the dependencies it > has, > >> but > >> > no code of mine is added in the jar, and I get this output in command > >> line: > >> > > >> > > >> > D:\projetos\tutorial>mvn assembly:single > >> > [INFO] Scanning for projects... > >> > [INFO] > >> > [INFO] > >> > > ------------------------------------------------------------------------ > >> > [INFO] Building tutorial 1.0-SNAPSHOT > >> > [INFO] > >> > > ------------------------------------------------------------------------ > >> > [INFO] > >> > [INFO] --- maven-assembly-plugin:2.3:single (default-cli) @ tutorial > --- > >> > *[WARNING] Cannot include project artifact: > >> > com.company:tutorial:jar:1.0-SNAPSHOT; it doesn't have an associated > file > >> > or directory.* > >> > [INFO] META-INF/ already added, skipping > >> > [INFO] META-INF/MANIFEST.MF already added, skipping > >> > [INFO] org/ already added, skipping > >> > [INFO] org/apache/ already added, skipping > >> > [INFO] org/apache/http/ already added, skipping > >> > [INFO] org/apache/http/impl/ already added, skipping > >> > [INFO] META-INF/NOTICE.txt already added, skipping > >> > [INFO] META-INF/LICENSE.txt already added, skipping > >> > [INFO] META-INF/maven/ already added, skipping > >> > [INFO] META-INF/maven/org.apache.httpcomponents/ already added, > skipping > >> > [INFO] META-INF/ already added, skipping > >> > [INFO] META-INF/MANIFEST.MF already added, skipping > >> > [INFO] org/ already added, skipping > >> > [INFO] org/apache/ already added, skipping > >> > [INFO] META-INF/maven/ already added, skipping > >> > [INFO] META-INF/ already added, skipping > >> > [INFO] META-INF/MANIFEST.MF already added, skipping > >> > [INFO] org/ already added, skipping > >> > [INFO] org/apache/ already added, skipping > >> > [INFO] org/apache/commons/ already added, skipping > >> > [INFO] META-INF/LICENSE.txt already added, skipping > >> > [INFO] META-INF/NOTICE.txt already added, skipping > >> > [INFO] META-INF/maven/ already added, skipping > >> > [INFO] Building jar: > >> > > >> > D:\projetos\tutorial\target\tutorial-1.0-SNAPSHOT-jar-with-dependencies.jar > >> > [INFO] META-INF/ already added, skipping > >> > [INFO] META-INF/MANIFEST.MF already added, skipping > >> > [INFO] org/ already added, skipping > >> > [INFO] org/apache/ already added, skipping > >> > [INFO] org/apache/http/ already added, skipping > >> > [INFO] org/apache/http/impl/ already added, skipping > >> > [INFO] META-INF/NOTICE.txt already added, skipping > >> > [INFO] META-INF/LICENSE.txt already added, skipping > >> > [INFO] META-INF/maven/ already added, skipping > >> > [INFO] META-INF/maven/org.apache.httpcomponents/ already added, > skipping > >> > [INFO] META-INF/ already added, skipping > >> > [INFO] META-INF/MANIFEST.MF already added, skipping > >> > [INFO] org/ already added, skipping > >> > [INFO] org/apache/ already added, skipping > >> > [INFO] META-INF/maven/ already added, skipping > >> > [INFO] META-INF/ already added, skipping > >> > [INFO] META-INF/MANIFEST.MF already added, skipping > >> > [INFO] org/ already added, skipping > >> > [INFO] org/apache/ already added, skipping > >> > [INFO] org/apache/commons/ already added, skipping > >> > [INFO] META-INF/LICENSE.txt already added, skipping > >> > [INFO] META-INF/NOTICE.txt already added, skipping > >> > [INFO] META-INF/maven/ already added, skipping > >> > [INFO] > >> > > ------------------------------------------------------------------------ > >> > [INFO] BUILD SUCCESS > >> > [INFO] > >> > > ------------------------------------------------------------------------ > >> > [INFO] Total time: 1.437s > >> > [INFO] Finished at: Tue Apr 17 06:38:42 BRT 2012 > >> > [INFO] Final Memory: 4M/15M > >> > [INFO] > >> > > ------------------------------------------------------------------------ > >> > D:\projetos\tutorial> > >> > > >> > > >> > Does anyone please have any idea? I am getting crazy with this > problem. > >> > > >> > Thank you very much, > >> > Kind regards, > >> > > >> > QL. > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
