On Tue, 2005-07-05 at 21:20 -0400, Vitaliy Geraymovych wrote:
> Thanks, I will definitely post in into the group once I can make it run :)
> 
> But right now no matter what I set in execution and goal m2 always
> does nothing in resources phase.
> 
> Here is my latest 
> 
> <execution>
>   <phase>generate-sources</phase>
>   <goals>
>       <goal>resources</goal>
>   </goals>
> </execution>
> 
> m2 shows:
> 
> clean:clean
> resources:resources
> compiler:compile

Let me run though a short example to try and help. To generate sources
you must first have a plugin that participates in the generate-sources
phase like the Antlr plugin:

http://svn.apache.org/viewcvs.cgi/maven/components/trunk/maven-
plugins/maven-antlr-
plugin/src/main/java/org/apache/maven/plugin/antlr/AntlrPlugin.java?
rev=209381&view=markup

Notice the annotations:

/**
 * @goal generate
 * @phase generate-sources
 * @requiresDependencyResolution compile
 * @description Antlr plugin
 */

The first two lines say "I want to be fit into the generate-sources
phase and my 'handle' is generate".

So this is all fine and dandy, we have a plugin that wants to generate
some sources from a Antlr grammar but how do we use it. You need to
specify that you want to use it in your POM:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antlr-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
        <configuration>
          <grammars>java.g</grammars>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  ...
</project>

If you then type "m2 compile" m2 will walk through the lifecycle
(http://maven.apache.org/maven2/lifecycle.html) and will eventually hit
the generate-sources phase and see you have a plugin configured that
wants to participate in that phase and the antlr plugin is executed with
your given configuration.

I just checked in the Antlr plugin and deployed so you can try this out
by downloading the little example I created to answer your question:

http://www.codehaus.org/~jvanzyl/generate-sources-example.zip

(ps you might have to wait for the antlr plugin to sync to ibiblio)

> Thanks again,
> Vitaliy
> 
> 
> 
> On 7/5/05, Jason van Zyl <[EMAIL PROTECTED]> wrote:
> > On Tue, 2005-07-05 at 20:51 -0400, Vitaliy Geraymovych wrote:
> > > The second I sent email I realized that after following link to
> > > ibiblio site :) So I returned back to specifying jaxb plug in in
> > > pom.xml. What I am currently confused with is how to connect the plug
> > > in into specific execution phase. Let say I want to run jaxb
> > > generation in generate-sources phase. And I am not sure if I want to
> > > execute separately what my command line will look like: m2
> > > generate-sources:?
> > 
> > That would do but you would probably just do:
> > 
> > m2 install
> > 
> > And m2 would walk through all the phases. If you have JAXP in your
> > plugins section it will be added to the generate-sources phase because
> > part of creating a plugin like a JAXP plugin is creating some metadata
> > that tells m2 what phase the plugin should be executed in.
> > 
> > Hope that helps. You can post to the user list. I will answer there as
> > well :-)
> > 
> > > Thanks for your help.
> > >
> > > Vitaliy
> > >
> > > On 7/5/05, Jason van Zyl <[EMAIL PROTECTED]> wrote:
> > > > On Tue, 2005-07-05 at 20:37 -0400, Vitaliy Geraymovych wrote:
> > > > > I added <executions> block but didn't have much luck. I went another
> > > > > rout and removed plugins sections completely. I tried to run m2
> > > > > jaxb:generate which seems trying to get latest jaxb plug in but fails
> > > > > with errors:
> > > > >
> > > > > Unable to find release for artifact: ... 
> > > > > http://repo1.maven.org/maven2/plugins
> > > > >
> > > > > FileNotFoundException:
> > > > > http://www.ibiblio.org/maven2/plugins/org/apache/maven/plugins/maven-jaxb-plugin/maven-jaxb-plugin-RELEASE.version.txt
> > > > >
> > > > > It seems that I am doing something conceptually wrong.
> > > > >
> > > > > I would appreciate any pointers.
> > > >
> > > > We don't actually have a JAXB plugin :-)
> > > >
> > > > We have an example in a presentation of a JAXB plugin but I don't
> > > > believe we actually have one in m2! Sorry about the confusion.
> > > >
> > > > > Thanks,
> > > > > Vitaliy
> > > > >
> > > > >
> > > > >
> > > > > On 7/5/05, Jason van Zyl <[EMAIL PROTECTED]> wrote:
> > > > > > On Tue, 2005-07-05 at 17:38 -0400, Vitaliy Geraymovych wrote:
> > > > > > > Hi All,
> > > > > > >
> > > > > > > Sorry for the beginners question but I was unable to find answer
> > > > > > > anywhere else. I am currently playing with Maven 2 with the goal 
> > > > > > > of
> > > > > > > replacing our ant build script. I got stuck trying to add jaxb
> > > > > > > generation to the project. I added maven-jaxb-plugin plug in to 
> > > > > > > the
> > > > > > > plugins section but can't to make it run.
> > > > > >
> > > > > > Take a peek at:
> > > > > >
> > > > > > http://maven.apache.org/maven2/lifecycle.html
> > > > > >
> > > > > > You are missing the <executions/> element.
> > > > > >
> > > > > > > I am executing maven with this command: m2 clean:clean package
> > > > > > >
> > > > > > > m2 always does [clean:clean], [resources:resources], 
> > > > > > > [compiler:compile].
> > > > > > >
> > > > > > > Here is the section of pom.xml that defines plug in:
> > > > > > >
> > > > > > >       <plugins>
> > > > > > >               <plugin>
> > > > > > >                       <groupId>org.apache.maven.plugins</groupId>
> > > > > > >                       <artifactId>maven-jaxb-plugin</artifactId>
> > > > > > >                       <version>1.0</version>
> > > > > > >                               <goals>
> > > > > > >                                       <goal>
> > > > > > >                                               
> > > > > > > <id>generate-sources</id>
> > > > > > >                                       </goal>
> > > > > > >                               </goals>
> > > > > > >               </plugin>
> > > > > > >       </plugins>
> > > > > > >
> > > > > > > I would appreciate any help,
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Vitaliy
> > > > > > >
> > > > > > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > > For additional commands, e-mail: users-h
> > > > > >
> > > > > > > [EMAIL PROTECTED]
> > > > > > >
> > > > > > >
> > > > > > --
> > > > > > jvz.
> > > > > >
> > > > > > Jason van Zyl
> > > > > > jason at maven.org
> > > > > > http://maven.apache.org
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > --
> > > > jvz.
> > > >
> > > > Jason van Zyl
> > > > jason at maven.org
> > > > http://maven.apache.org
> > > >
> > > >
> > > >
> > >
> > --
> > jvz.
> > 
> > Jason van Zyl
> > jason at maven.org
> > http://maven.apache.org
> > 
> > 
> >
> 
-- 
jvz.

Jason van Zyl
jason at maven.org
http://maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to