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 <and...@hammar.net> 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 <fraterql...@gmail.com> 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: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to