You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andrew Pennebaker <ap...@42six.com> on 2013/09/10 16:41:12 UTC

`mvn generate-sources` skipping my custom executions?

I added executions for `.thrift -> .java` as part of the generate-sources
phase, using `maven-antrun-plugin`. But when I enter `mvn
generate-sources`, Maven skips right over this execution.

Any idea why it would do this?

pom.xml:

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>

    ...

      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>

      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>generate-sources</id>
                <phase>generate-sources</phase>
                <configuration>
                  <tasks>
                    <exec executable="${thrift.executable}">
                      <arg value="--gen" />
                      <arg value="java:beans" />
                      <arg value="-o" />
                      <arg value="src/main/java/com/... " />
                      <arg value="src/main/thrift/... .thrift" />
                    </exec>
                  </tasks>
                </configuration>
              </execution>
              <execution>
                <id>clean</id>
                <phase>clean</phase>
                <configuration>
                  <tasks>
                    <delete>
                      <fileset dir="src/main/java/com/... " includes="...
.java" />
                    </delete>
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>

      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </project>

Also posted on StackOverflow <http://stackoverflow.com/questions/18721684>.

Re: `mvn generate-sources` skipping my custom executions?

Posted by Andrew Pennebaker <ap...@42six.com>.
Thanks, that did it!


On Tue, Sep 10, 2013 at 11:00 AM, Vincent Latombe <vincent.latombe@gmail.com
> wrote:

> Hi,
>
> you are missing
> <goals>
>   <goal>run</goal>
> </goals>
>
> from the execution block for antrun.
>
>
> Vincent
>
>
> 2013/9/10 Andrew Pennebaker <ap...@42six.com>
>
> > I added executions for `.thrift -> .java` as part of the generate-sources
> > phase, using `maven-antrun-plugin`. But when I enter `mvn
> > generate-sources`, Maven skips right over this execution.
> >
> > Any idea why it would do this?
> >
> > pom.xml:
> >
> >     <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> > http://www.w3.org/2001/XMLSchema-instance"
> >       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > http://maven.apache.org/xsd/maven-4.0.0.xsd">
> >       <modelVersion>4.0.0</modelVersion>
> >
> >     ...
> >
> >       <properties>
> >
> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> >       </properties>
> >
> >       <build>
> >         <plugins>
> >           <plugin>
> >             <artifactId>maven-antrun-plugin</artifactId>
> >             <executions>
> >               <execution>
> >                 <id>generate-sources</id>
> >                 <phase>generate-sources</phase>
> >                 <configuration>
> >                   <tasks>
> >                     <exec executable="${thrift.executable}">
> >                       <arg value="--gen" />
> >                       <arg value="java:beans" />
> >                       <arg value="-o" />
> >                       <arg value="src/main/java/com/... " />
> >                       <arg value="src/main/thrift/... .thrift" />
> >                     </exec>
> >                   </tasks>
> >                 </configuration>
> >               </execution>
> >               <execution>
> >                 <id>clean</id>
> >                 <phase>clean</phase>
> >                 <configuration>
> >                   <tasks>
> >                     <delete>
> >                       <fileset dir="src/main/java/com/... " includes="...
> > .java" />
> >                     </delete>
> >                   </tasks>
> >                 </configuration>
> >               </execution>
> >             </executions>
> >           </plugin>
> >         </plugins>
> >       </build>
> >
> >       <dependencies>
> >         <dependency>
> >           <groupId>junit</groupId>
> >           <artifactId>junit</artifactId>
> >           <version>3.8.1</version>
> >           <scope>test</scope>
> >         </dependency>
> >       </dependencies>
> >     </project>
> >
> > Also posted on StackOverflow <
> http://stackoverflow.com/questions/18721684
> > >.
> >
>

Re: `mvn generate-sources` skipping my custom executions?

Posted by Vincent Latombe <vi...@gmail.com>.
Hi,

you are missing
<goals>
  <goal>run</goal>
</goals>

from the execution block for antrun.


Vincent


2013/9/10 Andrew Pennebaker <ap...@42six.com>

> I added executions for `.thrift -> .java` as part of the generate-sources
> phase, using `maven-antrun-plugin`. But when I enter `mvn
> generate-sources`, Maven skips right over this execution.
>
> Any idea why it would do this?
>
> pom.xml:
>
>     <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
>       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>       <modelVersion>4.0.0</modelVersion>
>
>     ...
>
>       <properties>
>         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>       </properties>
>
>       <build>
>         <plugins>
>           <plugin>
>             <artifactId>maven-antrun-plugin</artifactId>
>             <executions>
>               <execution>
>                 <id>generate-sources</id>
>                 <phase>generate-sources</phase>
>                 <configuration>
>                   <tasks>
>                     <exec executable="${thrift.executable}">
>                       <arg value="--gen" />
>                       <arg value="java:beans" />
>                       <arg value="-o" />
>                       <arg value="src/main/java/com/... " />
>                       <arg value="src/main/thrift/... .thrift" />
>                     </exec>
>                   </tasks>
>                 </configuration>
>               </execution>
>               <execution>
>                 <id>clean</id>
>                 <phase>clean</phase>
>                 <configuration>
>                   <tasks>
>                     <delete>
>                       <fileset dir="src/main/java/com/... " includes="...
> .java" />
>                     </delete>
>                   </tasks>
>                 </configuration>
>               </execution>
>             </executions>
>           </plugin>
>         </plugins>
>       </build>
>
>       <dependencies>
>         <dependency>
>           <groupId>junit</groupId>
>           <artifactId>junit</artifactId>
>           <version>3.8.1</version>
>           <scope>test</scope>
>         </dependency>
>       </dependencies>
>     </project>
>
> Also posted on StackOverflow <http://stackoverflow.com/questions/18721684
> >.
>