You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by khkachn <de...@verizon.net> on 2008/11/06 00:08:46 UTC

Non lifecycle tasks in Maven

Hi,

  Is it possible to define non lifecycle tasks in Maven? I would like to
generate Axis stubs from a wsdl file, but don't want to do it with every
build.  How do I go about doing this?

Thanks
-- 
View this message in context: http://www.nabble.com/Non-lifecycle-tasks-in-Maven-tp20352013p20352013.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: Using a previous version of release and/or the maven SCM plugin

Posted by "Heck, Joe" <Jo...@disney.com>.
Ah, nevermind - 

After I asked, I tried a few more variations, finally actually LOOKING
at the super-pom to find out where it was supposed to go.

GFor the reference archives, my solution is:


<build>
...
  <pluginManagement>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-site-plugin</artifactId>
         <version>2.0-beta-7</version>
       </plugin>
     </plugins>
   </pluginManagement>
...
</build>

-joe

-----Original Message-----
From: users-return-93944-Joe.Heck=dig.com@maven.apache.org
[mailto:users-return-93944-Joe.Heck=dig.com@maven.apache.org] On Behalf
Of Heck, Joe
Sent: Wednesday, November 05, 2008 3:27 PM
To: Maven Users List
Cc: Jackson, Brian R
Subject: Using a previous version of release and/or the maven SCM plugin

I seem to be stumbling hard over a few bugs that have already been
identified, reported, and it looks like patches are available -
http://jira.codehaus.org/browse/SCM-415. Almost all of my environment is
using token based authentication with Perforce, so I thought I'd just
push back to the previous version of the Maven SCM plugin (1.0) until a
fix is formally released.

Unfortunately, I don't seem to be quite grokking how to do that. I've
tried adding the following into my project POM stanza, but it's not
terribly happy about it:

<build>
  <plugins>
    <groupId>org.apache.maven.release</groupId>
    <artifactId>maven-release</artifactId>
    <version>4</version>
  </plugins>
...
</build>

I've also tried just aiming it at the SCM plugin:

<build>
  <plugins>
    <groupId>org.apache.maven.scm</groupId>
    <artifactId>maven-scm</artifactId>
    <version>1.0</version>
  </plugins>
...
</build>

I've got 1.0 working fine on another system, but I'm at a complete loss
on how to specify that I want to use an earlier version of the SCM or
release plugin (and it's dependencies) until the kinks get worked out of
this latest version.

Can anyone enlighten me?

-joe

Joseph Heck
Disney Interactive Media Group


---------------------------------------------------------------------
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


Using a previous version of release and/or the maven SCM plugin

Posted by "Heck, Joe" <Jo...@disney.com>.
I seem to be stumbling hard over a few bugs that have already been
identified, reported, and it looks like patches are available -
http://jira.codehaus.org/browse/SCM-415. Almost all of my environment is
using token based authentication with Perforce, so I thought I'd just
push back to the previous version of the Maven SCM plugin (1.0) until a
fix is formally released.

Unfortunately, I don't seem to be quite grokking how to do that. I've
tried adding the following into my project POM stanza, but it's not
terribly happy about it:

<build>
  <plugins>
    <groupId>org.apache.maven.release</groupId>
    <artifactId>maven-release</artifactId>
    <version>4</version>
  </plugins>
...
</build>

I've also tried just aiming it at the SCM plugin:

<build>
  <plugins>
    <groupId>org.apache.maven.scm</groupId>
    <artifactId>maven-scm</artifactId>
    <version>1.0</version>
  </plugins>
...
</build>

I've got 1.0 working fine on another system, but I'm at a complete loss
on how to specify that I want to use an earlier version of the SCM or
release plugin (and it's dependencies) until the kinks get worked out of
this latest version.

Can anyone enlighten me?

-joe

Joseph Heck
Disney Interactive Media Group


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


Re: Non lifecycle tasks in Maven

Posted by khkachn <de...@verizon.net>.
am an ant user who is trying to get up to speed with Maven because I started
working on a project that uses it. In ant this would be simple, but I was
told not to create any build.xml files. 

There are a lot of tasks in a project that you will want to capture the
processing logic for and only run once in a blue moon. Things like run this
GUI or generate some test data for debugging or generate stubs. 

What I would like to be able to do is something like;

mvn genStubs

and have the result be a jar file with the compiled stub classes in it.

Ken


David Ojeda-2 wrote:
> 
> You are right Nick, I think this is a problem with this solution since I
> dont 
> think it is possible to re-evaluate the profile once a phase has finished
> or 
> started.
> 
> Let me know if you come up with another solution.
> 
> On Thursday 06 November 2008 05:29:38 Nick Stolwijk wrote:
>> Does this also work when you execute "mvn clean install" on a project
>> which has the generated sources? I think the profile activation will
>> only be looked at at the beginning of the build. After that, the clean
>> task removes the generated sources and your install phase would fail.
>>
>> With regards,
>>
>> Nick Stolwijk
>> ~Java Developer~
>>
>> Iprofs BV.
>> Claus Sluterweg 125
>> 2012 WS Haarlem
>> www.iprofs.nl
>>
>> On Thu, Nov 6, 2008 at 1:19 AM, David Ojeda <do...@integra.la> wrote:
>> > What a coincidence, I just stumbled with this problem.
>> > I solved it by using a profile that activates when the generated
>> classes
>> > directory is missing. The profile defines the task for class
>> generation.
>> > Here is a snip, I will post it completely in a different post, for
>> future
>> > axis2/maven users...
>> >
>> > I use xmlbeans so I could not use the maven axis plugins nor the maven
>> > xmlbeans plugin. But you'll get the idea
>> >
>> > <profiles>
>> >        <profile>
>> >            <id>sourcegen</id>
>> >            <activation>
>> >                <activeByDefault>false</activeByDefault>
>> >                <file>
>> >                    <missing>target/generated-sources</missing>
>> >                </file>
>> >            </activation>
>> >            <build>
>> >                <plugins>
>> >                    <plugin>
>> >                        <groupId>org.apache.maven.plugins</groupId>
>> >                        <artifactId>maven-antrun-plugin</artifactId>
>> >                        <version>1.3</version>
>> >                        <executions>
>> >                            <execution>
>> >                                <id>xmlbeans-source-code-generation
>> >                                </id>
>> >                                <phase>generate-sources</phase>
>> >                                <goals>
>> >                                    <goal>run</goal>
>> >                                </goals>
>> >                                <configuration>
>> >                                    <tasks>
>> >                                        <java
>> > classname="org.apache.xmlbeans.impl.tool.SchemaCompiler"
>> >                                            fork="true">
>> >                                            <arg
>> >                                                line="
>> >                                                -javasource 1.5
>> >                                                -srconly
>> >                                                -src target/generated-
>> > sources/xmlbeans
>> >                                                -d target/generated-
>> > sources/xmlbeans
>> >                                                src/main/wsdl
>> >                                                src/main/xsd" />
>> >                                            <classpath
>> > refid="maven.dependency.classpath" />
>> >                                            <classpath
>> > refid="maven.compile.classpath" />
>> >                                            <classpath
>> > refid="maven.runtime.classpath" />
>> >                                        </java>
>> >                                    </tasks>
>> >                                </configuration>
>> >                            </execution>
>> >                            <execution>
>> >                                <id>axis2-source-code-generation</id>
>> >                                <phase>generate-sources</phase>
>> >                                <goals>
>> >                                    <goal>run</goal>
>> >                                </goals>
>> >                                <configuration>
>> >                                    <tasks>
>> >                                        <java
>> > classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
>> >                                            <arg
>> >                                                line="
>> >                                        -o
>> target/generated-sources/axis2/
>> >                                        -t
>> >                                        -ss
>> >                                        -sd
>> >                                        -d xmlbeans
>> >                                        -Ewdc
>> >                                        --noBuildXML
>> >                                        -uri
>> > src/main/wsdl/WSIterautoID.wsdl" />
>> >                                            <classpath
>> > refid="maven.dependency.classpath" />
>> >                                            <classpath
>> > refid="maven.compile.classpath" />
>> >                                            <classpath
>> > refid="maven.runtime.classpath" />
>> >                                        </java>
>> >                                    </tasks>
>> >                                </configuration>
>> >                            </execution>
>> >                        </executions>
>> >                    </plugin>
>> >                    <plugin>
>> >                        <groupId>org.codehaus.mojo</groupId>
>> >                       
>> <artifactId>build-helper-maven-plugin</artifactId>
>> >                        <version>1.2</version>
>> >                        <executions>
>> >                            <execution>
>> >                                <id>add-source</id>
>> >                                <phase>generate-sources</phase>
>> >                                <goals>
>> >                                    <goal>add-source</goal>
>> >                                </goals>
>> >                                <configuration>
>> >                                    <sources>
>> >                                        <source>target/generated-
>> > sources/xmlbeans
>> >                                        </source>
>> >                                    </sources>
>> >                                </configuration>
>> >                            </execution>
>> >                        </executions>
>> >                    </plugin>
>> >                </plugins>
>> >            </build>
>> >        </profile>
>> >    </profiles>
>> >
>> > On Wednesday 05 November 2008 18:38:46 khkachn wrote:
>> >> Hi,
>> >>
>> >>   Is it possible to define non lifecycle tasks in Maven? I would like
>> to
>> >> generate Axis stubs from a wsdl file, but don't want to do it with
>> every
>> >> build.  How do I go about doing this?
>> >>
>> >> Thanks
>> >
>> > --
>> > Ing. David Ojeda
>> > Integra Consultores
>> > Caracas, Venezuela
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
> 
> -- 
> David Ojeda
> 
> 
> ---------------------------------------------------------------------
> 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/Non-lifecycle-tasks-in-Maven-tp20352013p20397028.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: Non lifecycle tasks in Maven

Posted by David Ojeda <do...@integra.la>.
You are right Nick, I think this is a problem with this solution since I dont 
think it is possible to re-evaluate the profile once a phase has finished or 
started.

Let me know if you come up with another solution.

On Thursday 06 November 2008 05:29:38 Nick Stolwijk wrote:
> Does this also work when you execute "mvn clean install" on a project
> which has the generated sources? I think the profile activation will
> only be looked at at the beginning of the build. After that, the clean
> task removes the generated sources and your install phase would fail.
>
> With regards,
>
> Nick Stolwijk
> ~Java Developer~
>
> Iprofs BV.
> Claus Sluterweg 125
> 2012 WS Haarlem
> www.iprofs.nl
>
> On Thu, Nov 6, 2008 at 1:19 AM, David Ojeda <do...@integra.la> wrote:
> > What a coincidence, I just stumbled with this problem.
> > I solved it by using a profile that activates when the generated classes
> > directory is missing. The profile defines the task for class generation.
> > Here is a snip, I will post it completely in a different post, for future
> > axis2/maven users...
> >
> > I use xmlbeans so I could not use the maven axis plugins nor the maven
> > xmlbeans plugin. But you'll get the idea
> >
> > <profiles>
> >        <profile>
> >            <id>sourcegen</id>
> >            <activation>
> >                <activeByDefault>false</activeByDefault>
> >                <file>
> >                    <missing>target/generated-sources</missing>
> >                </file>
> >            </activation>
> >            <build>
> >                <plugins>
> >                    <plugin>
> >                        <groupId>org.apache.maven.plugins</groupId>
> >                        <artifactId>maven-antrun-plugin</artifactId>
> >                        <version>1.3</version>
> >                        <executions>
> >                            <execution>
> >                                <id>xmlbeans-source-code-generation
> >                                </id>
> >                                <phase>generate-sources</phase>
> >                                <goals>
> >                                    <goal>run</goal>
> >                                </goals>
> >                                <configuration>
> >                                    <tasks>
> >                                        <java
> > classname="org.apache.xmlbeans.impl.tool.SchemaCompiler"
> >                                            fork="true">
> >                                            <arg
> >                                                line="
> >                                                -javasource 1.5
> >                                                -srconly
> >                                                -src target/generated-
> > sources/xmlbeans
> >                                                -d target/generated-
> > sources/xmlbeans
> >                                                src/main/wsdl
> >                                                src/main/xsd" />
> >                                            <classpath
> > refid="maven.dependency.classpath" />
> >                                            <classpath
> > refid="maven.compile.classpath" />
> >                                            <classpath
> > refid="maven.runtime.classpath" />
> >                                        </java>
> >                                    </tasks>
> >                                </configuration>
> >                            </execution>
> >                            <execution>
> >                                <id>axis2-source-code-generation</id>
> >                                <phase>generate-sources</phase>
> >                                <goals>
> >                                    <goal>run</goal>
> >                                </goals>
> >                                <configuration>
> >                                    <tasks>
> >                                        <java
> > classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
> >                                            <arg
> >                                                line="
> >                                        -o target/generated-sources/axis2/
> >                                        -t
> >                                        -ss
> >                                        -sd
> >                                        -d xmlbeans
> >                                        -Ewdc
> >                                        --noBuildXML
> >                                        -uri
> > src/main/wsdl/WSIterautoID.wsdl" />
> >                                            <classpath
> > refid="maven.dependency.classpath" />
> >                                            <classpath
> > refid="maven.compile.classpath" />
> >                                            <classpath
> > refid="maven.runtime.classpath" />
> >                                        </java>
> >                                    </tasks>
> >                                </configuration>
> >                            </execution>
> >                        </executions>
> >                    </plugin>
> >                    <plugin>
> >                        <groupId>org.codehaus.mojo</groupId>
> >                        <artifactId>build-helper-maven-plugin</artifactId>
> >                        <version>1.2</version>
> >                        <executions>
> >                            <execution>
> >                                <id>add-source</id>
> >                                <phase>generate-sources</phase>
> >                                <goals>
> >                                    <goal>add-source</goal>
> >                                </goals>
> >                                <configuration>
> >                                    <sources>
> >                                        <source>target/generated-
> > sources/xmlbeans
> >                                        </source>
> >                                    </sources>
> >                                </configuration>
> >                            </execution>
> >                        </executions>
> >                    </plugin>
> >                </plugins>
> >            </build>
> >        </profile>
> >    </profiles>
> >
> > On Wednesday 05 November 2008 18:38:46 khkachn wrote:
> >> Hi,
> >>
> >>   Is it possible to define non lifecycle tasks in Maven? I would like to
> >> generate Axis stubs from a wsdl file, but don't want to do it with every
> >> build.  How do I go about doing this?
> >>
> >> Thanks
> >
> > --
> > Ing. David Ojeda
> > Integra Consultores
> > Caracas, Venezuela
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org

-- 
David Ojeda


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


Re: Non lifecycle tasks in Maven

Posted by Nick Stolwijk <ni...@gmail.com>.
Does this also work when you execute "mvn clean install" on a project
which has the generated sources? I think the profile activation will
only be looked at at the beginning of the build. After that, the clean
task removes the generated sources and your install phase would fail.

With regards,

Nick Stolwijk
~Java Developer~

Iprofs BV.
Claus Sluterweg 125
2012 WS Haarlem
www.iprofs.nl



On Thu, Nov 6, 2008 at 1:19 AM, David Ojeda <do...@integra.la> wrote:
> What a coincidence, I just stumbled with this problem.
> I solved it by using a profile that activates when the generated classes
> directory is missing. The profile defines the task for class generation.
> Here is a snip, I will post it completely in a different post, for future
> axis2/maven users...
>
> I use xmlbeans so I could not use the maven axis plugins nor the maven
> xmlbeans plugin. But you'll get the idea
>
> <profiles>
>        <profile>
>            <id>sourcegen</id>
>            <activation>
>                <activeByDefault>false</activeByDefault>
>                <file>
>                    <missing>target/generated-sources</missing>
>                </file>
>            </activation>
>            <build>
>                <plugins>
>                    <plugin>
>                        <groupId>org.apache.maven.plugins</groupId>
>                        <artifactId>maven-antrun-plugin</artifactId>
>                        <version>1.3</version>
>                        <executions>
>                            <execution>
>                                <id>xmlbeans-source-code-generation
>                                </id>
>                                <phase>generate-sources</phase>
>                                <goals>
>                                    <goal>run</goal>
>                                </goals>
>                                <configuration>
>                                    <tasks>
>                                        <java
> classname="org.apache.xmlbeans.impl.tool.SchemaCompiler"
>                                            fork="true">
>                                            <arg
>                                                line="
>                                                -javasource 1.5
>                                                -srconly
>                                                -src target/generated-
> sources/xmlbeans
>                                                -d target/generated-
> sources/xmlbeans
>                                                src/main/wsdl
>                                                src/main/xsd" />
>                                            <classpath
> refid="maven.dependency.classpath" />
>                                            <classpath
> refid="maven.compile.classpath" />
>                                            <classpath
> refid="maven.runtime.classpath" />
>                                        </java>
>                                    </tasks>
>                                </configuration>
>                            </execution>
>                            <execution>
>                                <id>axis2-source-code-generation</id>
>                                <phase>generate-sources</phase>
>                                <goals>
>                                    <goal>run</goal>
>                                </goals>
>                                <configuration>
>                                    <tasks>
>                                        <java
> classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
>                                            <arg
>                                                line="
>                                        -o target/generated-sources/axis2/
>                                        -t
>                                        -ss
>                                        -sd
>                                        -d xmlbeans
>                                        -Ewdc
>                                        --noBuildXML
>                                        -uri src/main/wsdl/WSIterautoID.wsdl"
> />
>                                            <classpath
> refid="maven.dependency.classpath" />
>                                            <classpath
> refid="maven.compile.classpath" />
>                                            <classpath
> refid="maven.runtime.classpath" />
>                                        </java>
>                                    </tasks>
>                                </configuration>
>                            </execution>
>                        </executions>
>                    </plugin>
>                    <plugin>
>                        <groupId>org.codehaus.mojo</groupId>
>                        <artifactId>build-helper-maven-plugin</artifactId>
>                        <version>1.2</version>
>                        <executions>
>                            <execution>
>                                <id>add-source</id>
>                                <phase>generate-sources</phase>
>                                <goals>
>                                    <goal>add-source</goal>
>                                </goals>
>                                <configuration>
>                                    <sources>
>                                        <source>target/generated-
> sources/xmlbeans
>                                        </source>
>                                    </sources>
>                                </configuration>
>                            </execution>
>                        </executions>
>                    </plugin>
>                </plugins>
>            </build>
>        </profile>
>    </profiles>
>
> On Wednesday 05 November 2008 18:38:46 khkachn wrote:
>> Hi,
>>
>>   Is it possible to define non lifecycle tasks in Maven? I would like to
>> generate Axis stubs from a wsdl file, but don't want to do it with every
>> build.  How do I go about doing this?
>>
>> Thanks
>
> --
> Ing. David Ojeda
> Integra Consultores
> Caracas, Venezuela
>
> ---------------------------------------------------------------------
> 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


Re: Non lifecycle tasks in Maven

Posted by David Ojeda <do...@integra.la>.
What a coincidence, I just stumbled with this problem.
I solved it by using a profile that activates when the generated classes 
directory is missing. The profile defines the task for class generation.
Here is a snip, I will post it completely in a different post, for future 
axis2/maven users...

I use xmlbeans so I could not use the maven axis plugins nor the maven 
xmlbeans plugin. But you'll get the idea

<profiles>
        <profile>
            <id>sourcegen</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <file>
                    <missing>target/generated-sources</missing>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.3</version>
                        <executions>
                            <execution>
                                <id>xmlbeans-source-code-generation
                                </id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <java 
classname="org.apache.xmlbeans.impl.tool.SchemaCompiler"
                                            fork="true">
                                            <arg
                                                line="
                                                -javasource 1.5
                                                -srconly
                                                -src target/generated-
sources/xmlbeans 
                                                -d target/generated-
sources/xmlbeans
                                                src/main/wsdl 
                                                src/main/xsd" />
                                            <classpath 
refid="maven.dependency.classpath" />
                                            <classpath 
refid="maven.compile.classpath" />
                                            <classpath 
refid="maven.runtime.classpath" />
                                        </java>
                                    </tasks>
                                </configuration>
                            </execution>
                            <execution>
                                <id>axis2-source-code-generation</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <java 
classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
                                            <arg
                                                line="
                                        -o target/generated-sources/axis2/
                                        -t
                                        -ss
                                        -sd
                                        -d xmlbeans
                                        -Ewdc 
                                        --noBuildXML 
                                        -uri src/main/wsdl/WSIterautoID.wsdl" 
/>
                                            <classpath 
refid="maven.dependency.classpath" />
                                            <classpath 
refid="maven.compile.classpath" />
                                            <classpath 
refid="maven.runtime.classpath" />
                                        </java>
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>1.2</version>
                        <executions>
                            <execution>
                                <id>add-source</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>target/generated-
sources/xmlbeans
                                        </source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

On Wednesday 05 November 2008 18:38:46 khkachn wrote:
> Hi,
>
>   Is it possible to define non lifecycle tasks in Maven? I would like to
> generate Axis stubs from a wsdl file, but don't want to do it with every
> build.  How do I go about doing this?
>
> Thanks

-- 
Ing. David Ojeda
Integra Consultores
Caracas, Venezuela

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