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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> -- 
> David Ojeda
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to