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]

Reply via email to