It would appear that you really want 2 projects; one that makes a jar and one that makes a war.

Ron

On 26/06/2012 4:00 AM, myron0...@gmx.net wrote:
Hi

I have a WAR project, but the plugin is currently driving me crazy :)

What i want to archive:
Do not install/deploy the generated SNAPSHOT-WAR file, just the packaged JAR 
file out of the classes.
But of course it needs to be packaged/exploded for being local runnable per 
default.

I thought i could use
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>war</goal>
                        </goals>
                        <configuration>
                            <primaryArtifact>false</primaryArtifact>
                            <classifier>local</classifier>
                            <archiveClasses>true</archiveClasses><!-- include the 
classes as JAR inside the WAR -->
                            <attachClasses>false</attachClasses><!-- package 
additional -classes.jar -->
                            [...]
                        </configuration>
                    </execution>
                </executions>
            </plugin>
But what i see is, that
1) the default-war goal is ALWAYS executed, and
2) the primaryArtifact=false does not work, always installing the file

[INFO] --- maven-war-plugin:2.2:war (default-war) @ myproject ---     <-- 
always executed
[INFO] Packaging webapp
[INFO] Assembling webapp [myproject] in 
[C:\Users\myuser\myproject\target\myproject-1.0.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\myuser\myproject\src\main\webapp]
[INFO] Webapp assembled in [25300 msecs]
[INFO] Building war: 
C:\Users\myuser\myproject\target\myproject-1.0.0-SNAPSHOT.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default) @ myproject ---
[INFO] Building jar: 
C:\Users\myuser\myproject\target\myproject-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default) @ myproject ---    <-- my 
specified configuration
[INFO] Packaging webapp
[INFO] Assembling webapp [myproject] in 
[C:\Users\myuser\myproject\target\WebRoot-local]
[INFO] Processing war project
[INFO] Copying webapp webResources [C:\Users\myuser\myproject\src/main/config] 
to [C:\Users\myuser\myproject\target\WebRoot-local]
[INFO] Copying webapp webResources 
[C:\Users\myuser\myproject\src/main/webapp/WEB-INF] to 
[C:\Users\myuser\myproject\target\WebRoot-local]
[INFO] Copying webapp resources [C:\Users\myuser\myproject\src\main\webapp]
[INFO] Building jar: 
C:\Users\myuser\myproject\target\WebRoot-local\WEB-INF\lib\myproject-1.0.0-SNAPSHOT.jar
[INFO] Webapp assembled in [6390 msecs]
[INFO] Building war: 
C:\Users\myuser\myproject\target\myproject-1.0.0-SNAPSHOT-local.war
[INFO] WEB-INF\web.xml already added, skipping
With above config i get the classes jar and 2xWARs :/
Same for using no WAR execution; configuring on plugin level -> 1xWAR 
(default-war) always installed
Playing with archiveClasses & attachClasses does not work either.
Any other ideas to achieve this?
There is no skip parameter, i guess? (or a buildhelper:detach-atrifacts?)
So the WAR file is ALWAYS generated and attached b/c of <type>war</type> ??

The only workaround I've found so far is declaring the project as 
<type>jar</type>.
But executing the WAR plugin in package phase STILL attaches it....

TIA,
Myron



--
Ron Wheeler
President
Artifact Software Inc
email: rwhee...@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to