You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by asookazian <as...@gmail.com> on 2010/07/07 00:20:00 UTC

Maven 3 explode goal?

Currently, I'm running an ant target (unzip) to explode and then copy the
EAR+WAR to JBoss.  the jboss-maven-plugin is insufficient b/c the unpack
does not explode the WAR in the EAR.

Is this explode goal/plugin included as a feature in Maven 3?  thx.
-- 
View this message in context: http://maven.40175.n5.nabble.com/Maven-3-explode-goal-tp946368p946368.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Maven 3 explode goal?

Posted by asookazian <as...@gmail.com>.
http://maven.apache.org/plugins/maven-war-plugin/plugin-info.html

note the war:exploded goal!

http://maven.apache.org/plugins/maven-ear-plugin/plugin-info.html

there is no ear:exploded goal!

so how can i actually use 'war:exploded' goal when i run a 'mvn clean
install'??  thx.
-- 
View this message in context: http://maven.40175.n5.nabble.com/Maven-3-explode-goal-tp946368p946378.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Maven 3 explode goal?

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 07/07/2010 2:52 AM, Martin Höller wrote:
> Am Mittwoch, 7. Juli 2010 01:19:16 schrieb asookazian:
> [...]
>    
>> This is one area where Ant is much more flexible than Maven (or at least
>> it's easier to customize invocations of targets in Ant than it is with
>> goals in Maven's lifecycle phases)...
>>      
> Why don't you stick with Ant then?
>
>  From your previous mails it seems to me like you are trying to use Maven like
> you did with Ant. Maven is not Ant! If you want to use Maven, use it the
> Maven way or you won't benefit from it at all. Start with reading a good
> Maven book like "Maven - The Definitve Guide" [0] from Sonatype (which seems
> is now split into two books).
>
> hth,
> - martin
>
> [0] http://www.sonatype.com/products/maven/documentation/book-defguide
>    
Also get a Nexus repo.

Ron

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


Re: Maven 3 explode goal?

Posted by asookazian <as...@gmail.com>.
I am actually trying to create a custom lifecycle right now...  Not sure if I
need to use the forking that is covered here or not:
http://www.sonatype.com/books/mvnref-book/reference/writing-plugins-sect-custom-lifecycle.html
-- 
View this message in context: http://maven.40175.n5.nabble.com/Maven-3-explode-goal-tp946368p1044798.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Maven 3 explode goal?

Posted by Wayne Fay <wa...@gmail.com>.
> 1) I *must* use Maven for work project.  And currently we're stuck with
> 2.0.8 (we have no in-house Maven experts to help us upgrade to 2.2.x or

Since you're the one posting here, are you not the "in-house expert"?
If not, why aren't you asking these questions of your "experts" and
then they can ask here if they can't answer themselves? It seems like
your in-house experts aren't doing much for you anyway, so why bother
paying a lot of attention to the requirement that you stay on 2.0.8
for "in house support"?? There shouldn't be much stopping you from
upgrading from 2.0.8 to 2.2 except corporate policies -- technically,
it should all work without any (many) issues and would probably be
worth it.

> 2) I have read a couple books on Maven including the O'Reilly book (which is
> pretty decent btw).  Maven is so complex that it takes months of hands-on

This is your opinion. If you agree with and accept Maven's conventions
over configuration approach and have the ability to refactor your
software to meet its expectations, then you can have fairly complex
software building under Maven in a short period of time.

> 4) Maven should be able to accommodate an exploded WAR and EAR without
> having to package the WAR and then unexplode it.  And I should not have to
> use a plugin like jboss-maven-plugin unpack goal to achieve this (which

Maven's opinion is different from yours here.

> explodes the EAR but not the WAR).  I understand that the install lifecycle
> phase will ultimately install the EAR into a local Maven repo, but what if I
> don't necessarily need that to happen for my local dev builds on my dev box?

Maven is opinionated software. It sounds like you disagree with
several of its opinions including this one. For dev purposes, perhaps
it makes sense to just use Ant? There is no rule that says you can't
use both Ant and Maven to build your software.

> What exactly is 'war' or 'install' above?  Is that referring to a Maven
> plugin (e.g. maven-war-plugin and maven-install-plugin)? or a specific goal

The naming is groupId:artifactId:goal. The package line means "in the
package phase for the war lifecycle, execute the goal war in the
plugin o.a.m.p:m-w-p."

> (e.g. war:war)?  Maybe I can write a custom lifecycle which uses
> war:exploded instead...

Yes, this seems like a reasonable approach for your specific
requirements. I told you to look into simply making a custom lifecycle
yesterday.

Wayne

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


Re: Maven 3 explode goal?

Posted by asookazian <as...@gmail.com>.

Martin Höller wrote:
> 
> Am Mittwoch, 7. Juli 2010 01:19:16 schrieb asookazian:
> [...]
>> This is one area where Ant is much more flexible than Maven (or at least
>> it's easier to customize invocations of targets in Ant than it is with
>> goals in Maven's lifecycle phases)...
> 
> Why don't you stick with Ant then?
> 
> From your previous mails it seems to me like you are trying to use Maven
> like 
> you did with Ant. Maven is not Ant! If you want to use Maven, use it the 
> Maven way or you won't benefit from it at all. Start with reading a good 
> Maven book like "Maven - The Definitve Guide" [0] from Sonatype (which
> seems 
> is now split into two books).
> 
> hth,
> - martin
> 
> [0] http://www.sonatype.com/products/maven/documentation/book-defguide
> 
>  
> 

1) I *must* use Maven for work project.  And currently we're stuck with
2.0.8 (we have no in-house Maven experts to help us upgrade to 2.2.x or
3.0).

2) I have read a couple books on Maven including the O'Reilly book (which is
pretty decent btw).  Maven is so complex that it takes months of hands-on
experience to master in terms of adding modules/POMs, adding profiles,
creating plugins/MOJOs, creating a custom lifecycle, setting up CI (e.g.
Continuum) and Nexus repo, understanding (transitive) dependency management,
learning/using m2e in Eclipse WTP envmt, etc.

3) There is an example of hooking into Maven lifecycle/builds from Ant
build.xml script in the JBoss Weld (CDI RI) distro:

<target name="package">
      <maven target="install" basedir="${basedir}">
         <arg line="-f ${pom.file}" />
      </maven>
   </target>

<macrodef name="maven">
      <attribute name="target" />
      <attribute name="basedir" />
      <element name="args" implicit="true" optional="true" />
      <sequential>
         <java classname="org.codehaus.classworlds.Launcher" fork="true"
dir="@{basedir}" failonerror="true">
            <classpath>
               <fileset dir="${maven.dir}/boot">
                  <include name="*.jar" />
               </fileset>
               <fileset dir="${maven.dir}/bin">
                  <include name="*.*" />
               </fileset>
            </classpath>
            <sysproperty key="classworlds.conf"
value="${maven.dir}/bin/m2.conf" />
            <sysproperty key="maven.home" value="${maven.dir}" />
            <args />
            <arg line="@{target}" />
         </java>
      </sequential>
   </macrodef>

This is what I based my build.xml off of.

4) Maven should be able to accommodate an exploded WAR and EAR without
having to package the WAR and then unexplode it.  And I should not have to
use a plugin like jboss-maven-plugin unpack goal to achieve this (which
explodes the EAR but not the WAR).  I understand that the install lifecycle
phase will ultimately install the EAR into a local Maven repo, but what if I
don't necessarily need that to happen for my local dev builds on my dev box?

In the
http://svn.apache.org/repos/asf/maven/maven-2/tags/maven-2.2.0/maven-core/src/main/resources/META-INF/plexus/components.xml
file I see the following:

<!-- START SNIPPET: war-lifecycle -->
            <phases>
             
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
             
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
              <process-test-resources>
               
org.apache.maven.plugins:maven-resources-plugin:testResources
              </process-test-resources>
             
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
             
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
             
<package>org.apache.maven.plugins:maven-war-plugin:war</package>
             
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
             
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
            </phases>
            <!-- END SNIPPET: war-lifecycle -->

What exactly is 'war' or 'install' above?  Is that referring to a Maven
plugin (e.g. maven-war-plugin and maven-install-plugin)? or a specific goal
(e.g. war:war)?  Maybe I can write a custom lifecycle which uses
war:exploded instead...

-- 
View this message in context: http://maven.40175.n5.nabble.com/Maven-3-explode-goal-tp946368p1044748.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Maven 3 explode goal?

Posted by Martin Höller <ma...@xss.co.at>.
Am Mittwoch, 7. Juli 2010 01:19:16 schrieb asookazian:
[...]
> This is one area where Ant is much more flexible than Maven (or at least
> it's easier to customize invocations of targets in Ant than it is with
> goals in Maven's lifecycle phases)...

Why don't you stick with Ant then?

From your previous mails it seems to me like you are trying to use Maven like 
you did with Ant. Maven is not Ant! If you want to use Maven, use it the 
Maven way or you won't benefit from it at all. Start with reading a good 
Maven book like "Maven - The Definitve Guide" [0] from Sonatype (which seems 
is now split into two books).

hth,
- martin

[0] http://www.sonatype.com/products/maven/documentation/book-defguide

Re: Maven 3 explode goal?

Posted by Wayne Fay <wa...@gmail.com>.
> Is it possible to replace the war:war goal invocation during the package
> lifecycle phase with war:exploded instead?

You can create your own custom lifecycle (its not *that* tough) and do
whatever you want with your builds...

Wayne

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


Re: Maven 3 explode goal?

Posted by asookazian <as...@gmail.com>.
actually looks like this will work (but not perfect):

1) run 'mvn clean install' for parent POM
2) run 'mvn war:exploded' for EAR module
3) rename WAR directory (as required)
4) delete package WAR in EAR directory
5) copy exploded WAR directory (from #3) to EAR directory
6) copy to app server deploy directory

The problem is that the WAR is unnecessarily being packaged via war:war goal
during 'mvn clean install' (assuming during package phase).

Is it possible to replace the war:war goal invocation during the package
lifecycle phase with war:exploded instead?

Or must you invoke all the goals one a time at the command line instead of a
simple 'mvn clean install'?

This is one area where Ant is much more flexible than Maven (or at least
it's easier to customize invocations of targets in Ant than it is with goals
in Maven's lifecycle phases)...
-- 
View this message in context: http://maven.40175.n5.nabble.com/Maven-3-explode-goal-tp946368p946383.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Maven 3 explode goal?

Posted by asookazian <as...@gmail.com>.
Well I just ran 'mvn clean war:exploded' and that seems like a possibility as
then that directory just needs to be copied into the exploded EAR directory
in the target directory after (or during?) a 'mvn clean install'.

Has anybody else used the war:exploded goal like this for a completely
exploded EAR to copy to app server deploy directory?
-- 
View this message in context: http://maven.40175.n5.nabble.com/Maven-3-explode-goal-tp946368p946382.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Maven 3 explode goal?

Posted by Wayne Fay <wa...@gmail.com>.
> what about weblogic, websphere, glassfish, etc.?  i don't agree...

Then implement the functionality in a place like Plexus-IO or another
common/shared component and depend on it in the various jee
server-specific plugins that you require it in.

Wayne

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


Re: Maven 3 explode goal?

Posted by Anders Hammar <an...@hammar.net>.
If you want something that's app-server generic, take a look at the cargo
project.
http://cargo.codehaus.org/

/Anders

On Wed, Jul 7, 2010 at 00:37, asookazian <as...@gmail.com> wrote:

>
> what about weblogic, websphere, glassfish, etc.?  i don't agree...
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Maven-3-explode-goal-tp946368p946373.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Maven 3 explode goal?

Posted by asookazian <as...@gmail.com>.
what about weblogic, websphere, glassfish, etc.?  i don't agree...
-- 
View this message in context: http://maven.40175.n5.nabble.com/Maven-3-explode-goal-tp946368p946373.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Maven 3 explode goal?

Posted by Wayne Fay <wa...@gmail.com>.
> Currently, I'm running an ant target (unzip) to explode and then copy the
> EAR+WAR to JBoss.  the jboss-maven-plugin is insufficient b/c the unpack
> does not explode the WAR in the EAR.

You should probably look into adding this feature to the jboss-m-p
directly, rather than hoping it might be added in a future release of
Maven itself.

Wayne

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


Re: Maven 3 explode goal?

Posted by Stephen Connolly <st...@gmail.com>.
I see everyone ranting on about producing a fully exploded ear.... AFAIK,
maven already supports doing that (with the caviat that the unexploded war
will have to be produced for each war module [because you need to be able to
store it in the local/remote repo's]  If you don't produce a war file as
part of your build then you will have to build the exploded war _every
build_.  By exploding the .war file into the .ear you have the choice of
only building the .ear module and using the .war from your local repo]

In any case, to have an exploded .ear, you either just have to specify the
<unpack>true</unpack> option for each of the modules in your ear in the
m-ear-p configuration section, or you configure the <unpackTypes> option,
e.g.

<project>
  [...]
  <build>
    [...]
    <plugins>
      [...]
      <plugin>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.4.2</version>
        <configuration>
          <unpackTypes>jar,rar,war</unpackTypes>
        </configuration>
      </plugin>
      [...]
    </plugins>
    [...]
  </build>
  [...]
</project>

- Stephen

On 7 July 2010 21:56, Wayne Fay <wa...@gmail.com> wrote:

> > Well after some extensive experimentation with creating a custom
> lifecycle,
> > it appears as though using war:explode in components.xml with
> > <packaging>war</packaging> in the POM may not be possible.
>
> As I understand it, this is correct because Maven already has a
> pre-defined lifecycle for projects of type war. You could potentially
> produce a fully-customized build of Maven that did not contain the
> pre-defined war packaging lifecycle, but I wouldn't want to be
> involved in supporting it and mandating your developers to use it
> instead of the usual Maven distribution etc.
>
> > When I use <packaging>exploded</packaging>, it works ok.  But I don't
> think
> > this is feasible to use for a WAR project and not sure how to do this for
> a
> > EAR project (which contains one or more WARs).
>
> You would probably need to produce both exploded-war and exploded-ear
> packaging types and corresponding custom lifecycles.
>
> You may also find this webpage to be helpful, if you haven't already
> been reading it:
>
> http://www.sonatype.com/people/2009/08/create-a-customized-build-process-in-maven/
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Maven 3 explode goal?

Posted by Wayne Fay <wa...@gmail.com>.
> Well after some extensive experimentation with creating a custom lifecycle,
> it appears as though using war:explode in components.xml with
> <packaging>war</packaging> in the POM may not be possible.

As I understand it, this is correct because Maven already has a
pre-defined lifecycle for projects of type war. You could potentially
produce a fully-customized build of Maven that did not contain the
pre-defined war packaging lifecycle, but I wouldn't want to be
involved in supporting it and mandating your developers to use it
instead of the usual Maven distribution etc.

> When I use <packaging>exploded</packaging>, it works ok.  But I don't think
> this is feasible to use for a WAR project and not sure how to do this for a
> EAR project (which contains one or more WARs).

You would probably need to produce both exploded-war and exploded-ear
packaging types and corresponding custom lifecycles.

You may also find this webpage to be helpful, if you haven't already
been reading it:
http://www.sonatype.com/people/2009/08/create-a-customized-build-process-in-maven/

Wayne

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


Re: Maven 3 explode goal?

Posted by asookazian <as...@gmail.com>.
Well after some extensive experimentation with creating a custom lifecycle,
it appears as though using war:explode in components.xml with
<packaging>war</packaging> in the POM may not be possible.

When I use <packaging>exploded</packaging>, it works ok.  But I don't think
this is feasible to use for a WAR project and not sure how to do this for a
EAR project (which contains one or more WARs).

Refer to this thread for details:
http://maven.40175.n5.nabble.com/Creating-a-Custom-Lifecycle-tt1044781.html#a1044781
-- 
View this message in context: http://maven.40175.n5.nabble.com/Maven-3-explode-goal-tp946368p1044836.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Maven 3 explode goal?

Posted by asookazian <as...@gmail.com>.
btw, the need for this functionality is to support incremental hot deployment
(like copying facelets in JSF/Seam apps).
-- 
View this message in context: http://maven.40175.n5.nabble.com/Maven-3-explode-goal-tp946368p946370.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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