java - Maven: assembly-plugin is not run at all -
i pretty new maven, tried learn couple of times before , figured better off without maven. now, (un)fortunately have use maven in project i'd contribute to. problem @ point regarding packaging. i'd produce self-contained (aka "fat") jar dependencies included, , colleague who's played around maven helped me out pom file.
i have checked pom files, samples here on so. xml looks legit plugin not run @ all. note no errors, goes fine except no "fatjar". ideas might cause of problem?
below relevant portion of pom.xml. have seen contradicting code samples regards positioning of <configuration>
, <executions>
tags, tried pretty every variation have found, still no joy.
<plugin> <artifactid>maven-assembly-plugin</artifactid> <version>2.3</version> <executions> <execution> <id>make-jar-with-dependencies</id> <!-- used inheritance merges --> <phase>package</phase> <!-- bind packaging phase --> <goals> <goal>single</goal> </goals> </execution> </executions> <configuration> <finalname>projectname</finalname> <appendassemblyid>true</appendassemblyid> <descriptorrefs> <descriptorref>jar-with-dependencies</descriptorref> </descriptorrefs> <archive> <manifest> <mainclass>org.mydomain.projectname</mainclass> <addclasspath>true</addclasspath> </manifest> </archive> </configuration> </plugin>
edit_1 console output mvn clean package
asked @khmarbaise
[info] [info] --- maven-clean-plugin:2.4.1:clean (default-clean) @ myproject --- [info] deleting /home/user/workspace/project/target [info] [info] --- maven-resources-plugin:2.5:resources (default-resources) @ myproject --- [debug] execute contextualize [warning] using platform encoding (utf-8 actually) copy filtered resources, i.e. build platform dependent! [info] copying 41 resources [info] [info] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ myproject --- [warning] file encoding has not been set, using platform encoding utf-8, i.e. build platform dependent! [info] compiling 292 source files /home/user/workspace/project/target/classes [info] [info] --- maven-resources-plugin:2.5:testresources (default-testresources) @ myproject --- [debug] execute contextualize [warning] using platform encoding (utf-8 actually) copy filtered resources, i.e. build platform dependent! [info] skip non existing resourcedirectory /home/user/workspace/project/src/test/resources [info] [info] --- maven-compiler-plugin:2.3.2:testcompile (default-testcompile) @ myproject --- [info] nothing compile - classes date [info] [info] --- maven-surefire-plugin:2.10:test (default-test) @ myproject --- [info] no tests run. [info] surefire report directory: /home/user/workspace/project/target/surefire-reports ------------------------------------------------------- t e s t s ------------------------------------------------------- results : tests run: 0, failures: 0, errors: 0, skipped: 0 [info] [info] --- maven-jar-plugin:2.3.2:jar (default-jar) @ myproject --- [info] building jar: /home/user/workspace/project/target/myproject-2.0.jar [info] ------------------------------------------------------------------------ [info] build success [info] ------------------------------------------------------------------------ [info] total time: 12.210s [info] finished at: thu jun 07 11:45:14 cest 2012 [info] final memory: 18m/184m [info] ------------------------------------------------------------------------
i recommend create ueberjar using maven-shade-plugin, cause it's intention purpose. can maven-assembly-plugin well.
so after taking pom understand problem. first defined maven-assembly-plugin in pluginmanagement block not execute plugin furthermore have defined maven-assembly-plugin dependency separately superfluous. means remove following pom:
<dependency> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-assembly-plugin</artifactid> <version>2.3</version> <type>maven-plugin</type> </dependency>
you should define maven-assembler-plugin this:
<build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-assembly-plugin</artifactid> ...all configuration here.. </plugin> </plugins> </build>
furthermore i've seen many repository definition should handled repository manager instead. repositories in pom can recommend reading sonatype information furthermore should think else use project behind proxy etc. has change pom working or can't use cause defined repositories in pom can't reach.
Comments
Post a Comment