maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Wheeler <rwhee...@artifact-software.com>
Subject Re: Project as jar and war
Date Fri, 27 Aug 2010 12:24:35 GMT
  This is pretty common when you develop webservices.
We are using CXF for Web Service.
The WebService module produces the WAR for the service as well as a JAR 
that any client can use to construct its access modules that use the Web 
service.

Here are the fragment from thePOM and the entire assembly XML file.

I hope that this helps.

Ron

The Plug-in definition from the POM

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>

<descriptors>
<descriptor>assembly/tamsii-ws-client-jar.xml</descriptor>
</descriptors>
<appendAssemblyId>true</appendAssemblyId>
<attach>true</attach>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

The assembly file

<assembly>
<id>client</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>target/classes/com/artifact_software/lms/tamsii/model</directory>
<outputDirectory>/com/artifact_software/lms/tamsii/model</outputDirectory>
</fileSet>
<fileSet>
<directory>target/classes/com/artifact_software/lms/tamsii/services</directory>
<outputDirectory>/com/artifact_software/lms/tamsii/services</outputDirectory>
</fileSet>
</fileSets>
</assembly>

On 27/08/2010 5:03 AM, Stephen Connolly wrote:
> I suggest that you have a look at the war:war goal documentation,
> specifically around creation of a secondary jar artifact... but you are
> fighting maven and I recommend that you read
> http://www.sonatype.com/people/2010/08/how-to-migrate-from-ant-to-maven-project-structure/first
>
> On 27 August 2010 09:32, Sebastian Oerding<oerding@match2blue.com>  wrote:
>
>> Hello,
>>
>> when migrating to Maven 2 we have a multi-module project. The core
>> component is a web application but it also contains classes required for
>> other modules to compile.
>>
>> Let's say we have
>> 0 the parent pom project for all modules
>> A (the core) with packaging as war and
>> B which depends on A
>>
>> When running mvn install on the pom.xml from the parent project (0), maven
>> complains about an unresolved dependency for A.jar. While that's absolutely
>> correct as there is only A.war, not A.jar
>> I have some diffculties to solve this issue. When I tried to set type for
>> dependancy to war, I got some exceptions.
>>
>> I think the Maven way / good design would require to split up the project
>> but that is not possible by now, so please don't give that advise.
>> Is there a way to build the module twice, once as jar and once as war or to
>> tell Maven to include the required dependencies? From that what I've read
>> until now it should be possible by using two different pom.xml (yes, really
>> bad), but maybe it is possible by defining own goal/lifecyle phase and using
>> the assembly plugin (twice). But I'm new to Maven and this seems to be a
>> quite complex for me
>> as newbie by now.
>>
>> Today when running mvn install on the parent pom everything seems to be
>> fine. Has this issue been solved in the last two weeks? I haven't checked if
>> there is a new version of some Maven plugin and the things are really going
>> on the last few weeks, new versions of m2eclipse, maven3-SNAPSHOT (embedded
>> in m2eclipse) and some plugins all over there.
>>
>> With kind regards Sebastian
>>
>> --
>> Sebastian Oerding
>> Senior Developer
>> Sun Certified Java Programmer
>>
>> match2blue software development GmbH
>> Leutragraben 1
>> 07743 Jena
>> Germany
>>
>> Tel.:  +49(0) 3641 573 3474
>> Fax:   +49(0) 3641 573 3488
>> Mobil: +49(0) 176 96 036 136
>>
>> oerding@match2blue.com
>> www.match2blue.com
>>
>> Geschäftsführer: Michael Selle
>> Registernummer:  HRB 503726
>> Registergericht: Amtsgericht Jena
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>


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


Mime
View raw message