maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arnaud HERITIER" <aherit...@gmail.com>
Subject Re: Custom lifecycle and parameters in mojos
Date Thu, 23 Aug 2007 21:53:46 GMT
I found a solution but for me it's more a workaround that a feature.
I created a custom lifecycle AND a forked lifecycle.
component.xml :
    <component>
      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
      <role-hint>grails-app</role-hint>
      <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
      <configuration>
        <lifecycles>
          <lifecycle>
            <id>default</id>
            <!-- START SNIPPET: default grails-lifecycle -->
            <phases>
              <package>com.octo.mtg:grails-maven-plugin:maven-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: default grails-lifecycle -->
          </lifecycle>
        </lifecycles>
      </configuration>
    </component>
in the com.octo.mtg:grails-maven-plugin:maven-war I declare an execute :
 * @execute lifecycle="grailsPackage" phase="package"
and in the lifecycle.xml I just define my customized call of the
copy-dependencies mojo:
<lifecycles>
  <lifecycle>
    <id>grailsPackage</id>
    <phases>
      <phase>
        <id>package</id>
        <executions>
          <execution>
            <goals>
              <goal>org.apache.maven.plugins:maven-dependency-plugin:copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.basedir}/lib</outputDirectory>
              <excludeScope>provided</excludeScope>
              <includeTypes>jar</includeTypes>
            </configuration>
          </execution>
        </executions>
      </phase>
    </phases>
  </lifecycle>
</lifecycles>

If you have a better idea, do not hesitate to tell me.

Are there some improvements in maven 2.1 about lifecycle management ?

Arnaud

On 23/08/07, Arnaud HERITIER <aheritier@gmail.com> wrote:
> In debug mode I can see that my settings defined in the lifecycle.xml
> aren't used :
> [DEBUG] Configuring mojo
> 'org.apache.maven.plugins:maven-dependency-plugin:2.0-alpha-4:copy-dependencies'
> -->
> [DEBUG]   (f) excludeTransitive = false
> [DEBUG]   (s) failOnMissingClassifierArtifact = true
> [DEBUG]   (s) local = [local] -> file://E:/Data/maven-2/repository
> [DEBUG]   (s) markersDirectory =
> E:\OCTO\my-grails-app\target\dependency-maven-plugin-markers
> [DEBUG]   (f) outputAbsoluteArtifactFilename = false
> [DEBUG]   (s) outputDirectory = E:\OCTO\my-grails-app\target\dependency
> [DEBUG]   (f) overWriteIfNewer = true
> [DEBUG]   (f) overWriteReleases = false
> [DEBUG]   (f) overWriteSnapshots = false
> [DEBUG]   (f) project = org.apache.maven.project.MavenProject@b37ca4a8
> [DEBUG]   (f) reactorProjects = [org.apache.maven.project.MavenProject@b37ca4a8]
> [DEBUG]   (s) remoteRepos = [[forge.snapshots] ->
> http://forge.octo.com/archiva/repository/forge-snapshots,
> [forge.releases] ->
> http://forge.octo.com/archiva/repository/forge-releases, [central] ->
> http://repo1.maven.org/maven2]
> [DEBUG]   (f) silent = false
> [DEBUG]   (s) stripVersion = false
> [DEBUG]   (f) type = java-source
> [DEBUG]   (s) useRepositoryLayout = false
> [DEBUG]   (s) useSubDirectoryPerArtifact = false
> [DEBUG]   (s) useSubDirectoryPerType = false
> [DEBUG] -- end configuration --
>
> Arnaud
>
> On 23/08/07, Arnaud HERITIER <aheritier@gmail.com> wrote:
> > Hey Jason,
> >
> >   I had a look at it, and I tried to create a lifecycle.xml descriptor
> > but it doesn't do what I want.
> >   In my component.xml I have :
> >     <component>
> >       <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
> >       <role-hint>grails-app</role-hint>
> >       <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
> >       <configuration>
> >         <lifecycles>
> >           <lifecycle>
> >             <id>default</id>
> >             <!-- START SNIPPET: default grails-lifecycle -->
> >            <phases>
> > <initialize>org.apache.maven.plugins:maven-dependency-plugin:copy-dependencies</initialize>
> >               <package>com.octo.mtg:grails-maven-plugin:maven-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: default grails-lifecycle -->
> >           </lifecycle>
> >         </lifecycles>
> >       </configuration>
> >     </component>
> >
> >   and in the lifecycle.xml I have :
> >
> > <lifecycles>
> >   <lifecycle>
> >     <id>default</id>
> >     <phases>
> >       <phase>
> >         <id>initialize</id>
> >         <configuration>
> >           <outputDirectory>${basedir}/lib</outputDirectory>
> >           <excludedScope>provided</excludedScope>
> >         </configuration>
> >       </phase>
> >     </phases>
> >   </lifecycle>
> > </lifecycles>
> >
> > But when I launch maven I have :
> > [INFO] [dependency:copy-dependencies]
> > [INFO] Copying antlr-2.7.6.jar to
> > E:\OCTO\my-grails-app\target\dependency\antlr-2.7.6.jar
> > [INFO] Copying aspectjrt-1.5.3.jar to
> > E:\OCTO\my-grails-app\target\dependency\aspectjrt-1.5.3.jar
> > ...
> >
> > My dependencies are copied in the target/dependency directory and not
> > in ${basedir}/lib.
> > And the excludeScope doesn't seem to be used also.
> >
> > Any Idea ? I think I forgot something trivial but I don't see.
> >
> > Arnaud
> >
> >
> > On 23/08/07, Jason van Zyl <jason@maven.org> wrote:
> > >
> > > On 23 Aug 07, at 8:46 AM 23 Aug 07, Arnaud HERITIER wrote:
> > >
> > > > Is it possible with a META-INF/maven/lifecycle.xml instead of
> > > > META-INF/plexus/component.xml.
> > > >
> > > > I don't find a documentation about all of this. I need your help.
> > > >
> > >
> > > Look at the clover plugin for an example.
> > >
> > > > Thx
> > > >
> > > > Arnaud
> > > >
> > > > On 23/08/07, Arnaud HERITIER <aheritier@gmail.com> wrote:
> > > >> Hi Guys,
> > > >>
> > > >>   In a custom lifecycle I would like to use the dependency plugin
> > > >> (the
> > > >> copy-dependencies mojo to be exact) but I want to set some of its
> > > >> parameters (outputDirectory, excludedScopes).
> > > >>
> > > >>   Can I?
> > > >>   How ?
> > > >>
> > > >> --
> > > >> ..........................................................
> > > >> Arnaud HERITIER
> > > >> ..........................................................
> > > >> OCTO Technology - aheritier AT octo DOT com
> > > >> www.octo.com | blog.octo.com
> > > >> ..........................................................
> > > >> ASF - aheritier AT apache DOT org
> > > >> www.apache.org | maven.apache.org
> > > >> ...........................................................
> > > >>
> > > >
> > > >
> > > > --
> > > > ..........................................................
> > > > Arnaud HERITIER
> > > > ..........................................................
> > > > OCTO Technology - aheritier AT octo DOT com
> > > > www.octo.com | blog.octo.com
> > > > ..........................................................
> > > > ASF - aheritier AT apache DOT org
> > > > www.apache.org | maven.apache.org
> > > > ...........................................................
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: dev-help@maven.apache.org
> > > >
> > >
> > > Thanks,
> > >
> > > Jason
> > >
> > > ----------------------------------------------------------
> > > Jason van Zyl
> > > Founder and PMC Chair, Apache Maven
> > > jason at sonatype dot com
> > > ----------------------------------------------------------
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: dev-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > ..........................................................
> > Arnaud HERITIER
> > ..........................................................
> > OCTO Technology - aheritier AT octo DOT com
> > www.octo.com | blog.octo.com
> > ..........................................................
> > ASF - aheritier AT apache DOT org
> > www.apache.org | maven.apache.org
> > ...........................................................
> >
>
>
> --
> ..........................................................
> Arnaud HERITIER
> ..........................................................
> OCTO Technology - aheritier AT octo DOT com
> www.octo.com | blog.octo.com
> ..........................................................
> ASF - aheritier AT apache DOT org
> www.apache.org | maven.apache.org
> ...........................................................
>


-- 
..........................................................
Arnaud HERITIER
..........................................................
OCTO Technology - aheritier AT octo DOT com
www.octo.com | blog.octo.com
..........................................................
ASF - aheritier AT apache DOT org
www.apache.org | maven.apache.org
...........................................................

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


Mime
View raw message