You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Julien Henry <ju...@capgemini.com> on 2006/04/10 16:11:28 UTC

Setting up complex webapp

Hi,

I'm trying to make an existing complexe web application working with 
Maven 2. The first module is called "Framework". It contains java 
classes, JSP, xml, ... but it's not a webapp by itself. There are many 
applications based on this framework. Currently, I'm just focussed on a 
simple one. This application, called "ISF", contains classes, JSP, ... 
ISF classes depend on Framework classes.
Today, deployment is done by Ant scripts. Java part of the framework is 
store in a Jar file. Java part of ISF is store in a Jar too. And 
finally, all JSPs and other stuff are copied in the server directory.

I tried different solution to make it working with Maven:
- I tried to build a JAR of Framework, and to build a WAR of ISF, with 
Framework as dependency. But Framework JSP are finally in the JAR, 
instead of being in the root of the final WAR.
- I tried to build a WAR of Framework, and to build a war of ISF, with 
Framework as dependency. But compile of ISF failed, since ISF classes 
need Framework classes.

I'm a bit lost in the Maven world, and if someone could give me some tips...

Thanks

-- 

_________________________________________________________________________

Julien HENRY | **Capgemini Sud **| Nice

www.fr.capgemini.com <http://www.capgemini.com/>

Porte de l’Arénas – Entrée B | 455 Promenade des Anglais | 06200 Nice

**Join the Collaborative Business Experience**** **
_________________________________________________________________________


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


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


Re: Setting up complex webapp

Posted by "Eric S." <es...@metamicro.com>.

Martin Cooper-2 wrote:
> 
> On 4/10/06, Eric S. <es...@metamicro.com> wrote:
>>
>>
>> Hi,
>>
>> you can use the war dependency like this :
>>
>> web framework POM :
>> <project>
>>     <groupId>sample</groupId>
>>     <modelVersion>4.0.0</modelVersion>
>>     <artifactId>web-fwk</artifactId>
>>     <packaging>war</packaging>
>>     <version>0.9-SNAPSHOT</version>
>>     <name>Web Framework</name>
>> </project>
>>
>> web final POM
>> <project>
>>     <groupId>sample</groupId>
>>     <modelVersion>4.0.0</modelVersion>
>>     <artifactId>web</artifactId>
>>     <packaging>war</packaging>
>>     <version>0.9-SNAPSHOT</version>
>>     <name>Web</name>
>>     <dependencies>
>>         <dependency>
>>             <groupId>sample</groupId>
>>             <artifactId>web-fwk</artifactId>
>>             <version>0.9-SNAPSHOT</version>
>>             <type>war</type>
>>             <scope>compile</scope>
>>         </dependency>
> 
> 
> Does this really work? Maven will compile against all the jars in
> WEB-INF/lib and the classes in WEB-INF/classes? Is this documented
> somewhere?
> 
> This will copy the classes of web-fwk in the target/web/WEB-INF/classes
> directory.
> All the dependent lib (depend of the scope) in the target/web/WEB-INF/lib
> directory.
> 
>     </dependencies>
>>     <build>
>>     <finalName>${project.artifactId}</finalName>
>>       <plugins>
>>         <plugin>
>>           <groupId>org.apache.maven.plugins</groupId>
>>           <artifactId>maven-war-plugin</artifactId>
>>           <version>2.0-beta-3-SNAPSHOT</version>
>>           <executions>
>>             <execution>
>>               <phase>generate-sources</phase>
>>               <goals>
>>                 <goal>exploded</goal>
> 
> 
> The 'exploded' goal will try to *build* the exploded war, though, not just
> explode it. I doubt that's what you'd want. More likely, you'd want to use
> the dependency plugin to unpack the war. See:
> 
> http://mojo.codehaus.org/dependency-maven-plugin/unpack-mojo.html
> 
> --
> Martin Cooper
> 
> 
>               </goals>
>>             </execution>
>>           </executions>
>>         </plugin>
>>       </plugins>
>>   </build>
>> </project>
>>
>> This will exploded all war dependencies into your target directory and
>> classes of all war will be in the classpath.
>>
>> Eric
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Setting-up-complex-webapp-t1425211.html#a3844842
>> Sent from the Maven - Users forum at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
--
View this message in context: http://www.nabble.com/Setting-up-complex-webapp-t1425211.html#a3858770
Sent from the Maven - Users forum at Nabble.com.


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


Re: Setting up complex webapp

Posted by Martin Cooper <ma...@apache.org>.
On 4/10/06, Eric S. <es...@metamicro.com> wrote:
>
>
> Hi,
>
> you can use the war dependency like this :
>
> web framework POM :
> <project>
>     <groupId>sample</groupId>
>     <modelVersion>4.0.0</modelVersion>
>     <artifactId>web-fwk</artifactId>
>     <packaging>war</packaging>
>     <version>0.9-SNAPSHOT</version>
>     <name>Web Framework</name>
> </project>
>
> web final POM
> <project>
>     <groupId>sample</groupId>
>     <modelVersion>4.0.0</modelVersion>
>     <artifactId>web</artifactId>
>     <packaging>war</packaging>
>     <version>0.9-SNAPSHOT</version>
>     <name>Web</name>
>     <dependencies>
>         <dependency>
>             <groupId>sample</groupId>
>             <artifactId>web-fwk</artifactId>
>             <version>0.9-SNAPSHOT</version>
>             <type>war</type>
>             <scope>compile</scope>
>         </dependency>


Does this really work? Maven will compile against all the jars in
WEB-INF/lib and the classes in WEB-INF/classes? Is this documented
somewhere?

    </dependencies>
>     <build>
>     <finalName>${project.artifactId}</finalName>
>       <plugins>
>         <plugin>
>           <groupId>org.apache.maven.plugins</groupId>
>           <artifactId>maven-war-plugin</artifactId>
>           <version>2.0-beta-3-SNAPSHOT</version>
>           <executions>
>             <execution>
>               <phase>generate-sources</phase>
>               <goals>
>                 <goal>exploded</goal>


The 'exploded' goal will try to *build* the exploded war, though, not just
explode it. I doubt that's what you'd want. More likely, you'd want to use
the dependency plugin to unpack the war. See:

http://mojo.codehaus.org/dependency-maven-plugin/unpack-mojo.html

--
Martin Cooper


              </goals>
>             </execution>
>           </executions>
>         </plugin>
>       </plugins>
>   </build>
> </project>
>
> This will exploded all war dependencies into your target directory and
> classes of all war will be in the classpath.
>
> Eric
>
> --
> View this message in context:
> http://www.nabble.com/Setting-up-complex-webapp-t1425211.html#a3844842
> Sent from the Maven - Users forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Setting up complex webapp

Posted by "Eric S." <es...@metamicro.com>.
Hi,

you can use the war dependency like this :

web framework POM :
<project>
    <groupId>sample</groupId>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>web-fwk</artifactId>
    <packaging>war</packaging>
    <version>0.9-SNAPSHOT</version>
    <name>Web Framework</name>
</project>

web final POM
<project>
    <groupId>sample</groupId>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>web</artifactId>
    <packaging>war</packaging>
    <version>0.9-SNAPSHOT</version>
    <name>Web</name>
    <dependencies>
        <dependency>
            <groupId>sample</groupId>
            <artifactId>web-fwk</artifactId>
            <version>0.9-SNAPSHOT</version>
            <type>war</type>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>
    <finalName>${project.artifactId}</finalName>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <version>2.0-beta-3-SNAPSHOT</version>
          <executions>
            <execution>
              <phase>generate-sources</phase>
              <goals>
                <goal>exploded</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
  </build>
</project>

This will exploded all war dependencies into your target directory and
classes of all war will be in the classpath.

Eric

--
View this message in context: http://www.nabble.com/Setting-up-complex-webapp-t1425211.html#a3844842
Sent from the Maven - Users forum at Nabble.com.


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