You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "A. Alonso Dominguez" <al...@gmail.com> on 2006/04/05 17:06:23 UTC

M2 antrun plugin problem

Hi there,

Can anyone give me a hand? I can't get this to work. I'm tring to run an ant
task written in an external build.xml file:

<project name="portal-meta">
  <taskdef name="collect-metainfo"
           classname="
com.social_labs.portal.container.tools.ProviderMetaInfoCollector">
    <classpath refid="maven.plugin.classpath"/>
  </taskdef>

  <target name="meta" description="Compiles the source code">
    <collect-metainfo destdir="...">
      <fileset dir="..."/>
    </collect-metainfo>
  </target>
</project>

To get this I'm using the maven-antrun-plugin and I followed the
instructions found at
http://maven.apache.org/plugins/maven-antrun-plugin/classpaths.html.
The plugin configuration is as follows.

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>compile</id>
            <phase>compile</phase>
            <configuration>
              <tasks>
                <ant antfile="${basedir}/portal-container.build.xml"
inheritRefs="true">
                  <target name="meta" />
                </ant>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <artifactId>portal-container-impl</artifactId>
            <groupId>com.social_labs.portal</groupId>
            <version>${pom.version}</version>
          </dependency>
        </dependencies>
      </plugin>

The problem seems to be that the build.xml file doesn't inherits the
references from the POM because I
allways get this error message:

[ERROR] BUILD ERROR
[INFO]
----------------------------------------------------------------------------
[INFO] Error executing ant tasks

Embedded error: The following error occurred while executing this line:
E:\Proyectos\Enterprise Ring System\portal\modules\dao\impl\portal-
container.build.xml:5:
Reference maven.plugin.classpath not found.

Does anyone know what's happening? Is there another different way to do what
I'm trying?

Regards,
Alonso

Re: M2 antrun plugin problem

Posted by Dave Syer <da...@hotmail.com>.
> Dont think refid can be passed to <taskdef>??

This is a limitation of the <ant> task - so if it is a problem it is an ant
problem, not a maven problem.  You can't define a task with a <taskdef> at
project scope if it needs a reference that is passed in fro the parent
project using <ant> - the reference resolution happens too late.

The workaround is to define your task inside the target that needs it, e.g:

<target name="foo">
    <taskdef name="foo" classname="Foo"
classpathref="maven.test.classpath"/>
    <foo/>
</target>

works, but

<taskdef name="foo" classname="Foo" classpathref="maven.test.classpath"/>
<target name="foo">
    <foo/>
</target>

does not.

-- 
View this message in context: http://www.nabble.com/M2-antrun-plugin-problem-tf1400135.html#a5892203
Sent from the Maven - Users forum at Nabble.com.


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


Re: M2 antrun plugin problem

Posted by dan tran <da...@gmail.com>.
Today I encounter the same scenario.

Dont think refid can be passed to <taskdef>??

antrun's test6 does not cover this case.

suggestion?


On 4/5/06, Carlos Sanchez <ca...@apache.org> wrote:
>
> There's a test in maven-antrun-plugin\src\it\test6 and it's working for me
>
> On 4/5/06, A. Alonso Dominguez <al...@gmail.com> wrote:
> > Hi again,
> >
> > I tried with the two different instructions I got, the one from Siegmann
> and
> > the other one from Carlos Sanchez. None of them did work.
> >
> > I also tired to go a bit ahead: I have notice that the "<property ...
> />"
> > tag doesn't declares any path-like structure so I changed a bit the
> response
> > I got from Siegmann I now the plugin configuration is like this:
> >
> > <configuration>
> >  <tasks>
> >        <path id="maven.plugin.classpath">
> >             <pathelement location="${maven.plugin.classpath}" />
> >         </path>
> >         <ant antfile="${basedir}/portal-container.build.xml"
> > inheritRefs="true">
> >              <target name="meta" />
> >         </ant>
> >  </tasks>
> > </configuration>
> >
> > Now, Maven informs about that will override the reference to "
> > maven.plugin.classpath" but It eventually fails again:
> >
> > [INFO] [antrun:run {execution: compile}]
> > [INFO] Executing tasks
> > Overriding previous definition of reference to maven.plugin.classpath
> > [INFO]
> >
> ----------------------------------------------------------------------------
> > [ERROR] BUILD ERROR
> > [INFO]
> >
> ----------------------------------------------------------------------------
> > [INFO] Error executing ant tasks
> >
> > Embedded error: The following error occurred while executing this line:
> > E:\Proyectos\Enterprise Ring System\portal\modules\dao\impl\portal-
> > container.build.xml:5:
> > Reference maven.plugin.classpath not found.
> >
> > Because of this I'm really confused. Thinking about that, what I really
> > whant is a way to run an Ant task developed by myself.
> > Does anyone know a way to define that Ant task inside the POM (or in a
> > different place) so I can configure the plugin like this?:
> >
> > <configuration>
> >  <tasks>
> >        <collect-metainfo destdir="maven.runtime.classpath">
> >          <fileset dir="maven.compile.classpath"/>
> >        </collect-metainfo>
> >  </tasks>
> > </configuration>
> >
> > Alonso
> >
> > 2006/4/5, Carlos Sanchez <ca...@apache.org>:
> > >
> > > You may need the latest version of the plugin 1.2-SNAPSHOT, building
> > > it from sources or adding this repository to your pom:
> > > http://cvs.apache.org/maven-snapshot-repository
> > >
> > >
> > > On 4/5/06, A. Alonso Dominguez <al...@gmail.com> wrote:
> > > > Hi there,
> > > >
> > > > Can anyone give me a hand? I can't get this to work. I'm tring to
> run an
> > > ant
> > > > task written in an external build.xml file:
> > > >
> > > > <project name="portal-meta">
> > > >   <taskdef name="collect-metainfo"
> > > >            classname="
> > > > com.social_labs.portal.container.tools.ProviderMetaInfoCollector">
> > > >     <classpath refid="maven.plugin.classpath"/>
> > > >   </taskdef>
> > > >
> > > >   <target name="meta" description="Compiles the source code">
> > > >     <collect-metainfo destdir="...">
> > > >       <fileset dir="..."/>
> > > >     </collect-metainfo>
> > > >   </target>
> > > > </project>
> > > >
> > > > To get this I'm using the maven-antrun-plugin and I followed the
> > > > instructions found at
> > > > http://maven.apache.org/plugins/maven-antrun-plugin/classpaths.html.
> > > > The plugin configuration is as follows.
> > > >
> > > > <plugin>
> > > >         <groupId>org.apache.maven.plugins</groupId>
> > > >         <artifactId>maven-antrun-plugin</artifactId>
> > > >         <executions>
> > > >           <execution>
> > > >             <id>compile</id>
> > > >             <phase>compile</phase>
> > > >             <configuration>
> > > >               <tasks>
> > > >                 <ant antfile="${basedir}/portal-container.build.xml"
> > > > inheritRefs="true">
> > > >                   <target name="meta" />
> > > >                 </ant>
> > > >               </tasks>
> > > >             </configuration>
> > > >             <goals>
> > > >               <goal>run</goal>
> > > >             </goals>
> > > >           </execution>
> > > >         </executions>
> > > >         <dependencies>
> > > >           <dependency>
> > > >             <artifactId>portal-container-impl</artifactId>
> > > >             <groupId>com.social_labs.portal</groupId>
> > > >             <version>${pom.version}</version>
> > > >           </dependency>
> > > >         </dependencies>
> > > >       </plugin>
> > > >
> > > > The problem seems to be that the build.xml file doesn't inherits the
> > > > references from the POM because I
> > > > allways get this error message:
> > > >
> > > > [ERROR] BUILD ERROR
> > > > [INFO]
> > > >
> > >
> ----------------------------------------------------------------------------
> > > > [INFO] Error executing ant tasks
> > > >
> > > > Embedded error: The following error occurred while executing this
> line:
> > > > E:\Proyectos\Enterprise Ring System\portal\modules\dao\impl\portal-
> > > > container.build.xml:5:
> > > > Reference maven.plugin.classpath not found.
> > > >
> > > > Does anyone know what's happening? Is there another different way to
> do
> > > what
> > > > I'm trying?
> > > >
> > > > Regards,
> > > > Alonso
> > > >
> > > >
> > >
> > >
> > > --
> > > I could give you my word as a Spaniard.
> > > No good. I've known too many Spaniards.
> > >                              -- The Princess Bride
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
>
>
> --
> I could give you my word as a Spaniard.
> No good. I've known too many Spaniards.
>                             -- The Princess Bride
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: M2 antrun plugin problem

Posted by Carlos Sanchez <ca...@apache.org>.
There's a test in maven-antrun-plugin\src\it\test6 and it's working for me

On 4/5/06, A. Alonso Dominguez <al...@gmail.com> wrote:
> Hi again,
>
> I tried with the two different instructions I got, the one from Siegmann and
> the other one from Carlos Sanchez. None of them did work.
>
> I also tired to go a bit ahead: I have notice that the "<property ... />"
> tag doesn't declares any path-like structure so I changed a bit the response
> I got from Siegmann I now the plugin configuration is like this:
>
> <configuration>
>  <tasks>
>        <path id="maven.plugin.classpath">
>             <pathelement location="${maven.plugin.classpath}" />
>         </path>
>         <ant antfile="${basedir}/portal-container.build.xml"
> inheritRefs="true">
>              <target name="meta" />
>         </ant>
>  </tasks>
> </configuration>
>
> Now, Maven informs about that will override the reference to "
> maven.plugin.classpath" but It eventually fails again:
>
> [INFO] [antrun:run {execution: compile}]
> [INFO] Executing tasks
> Overriding previous definition of reference to maven.plugin.classpath
> [INFO]
> ----------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ----------------------------------------------------------------------------
> [INFO] Error executing ant tasks
>
> Embedded error: The following error occurred while executing this line:
> E:\Proyectos\Enterprise Ring System\portal\modules\dao\impl\portal-
> container.build.xml:5:
> Reference maven.plugin.classpath not found.
>
> Because of this I'm really confused. Thinking about that, what I really
> whant is a way to run an Ant task developed by myself.
> Does anyone know a way to define that Ant task inside the POM (or in a
> different place) so I can configure the plugin like this?:
>
> <configuration>
>  <tasks>
>        <collect-metainfo destdir="maven.runtime.classpath">
>          <fileset dir="maven.compile.classpath"/>
>        </collect-metainfo>
>  </tasks>
> </configuration>
>
> Alonso
>
> 2006/4/5, Carlos Sanchez <ca...@apache.org>:
> >
> > You may need the latest version of the plugin 1.2-SNAPSHOT, building
> > it from sources or adding this repository to your pom:
> > http://cvs.apache.org/maven-snapshot-repository
> >
> >
> > On 4/5/06, A. Alonso Dominguez <al...@gmail.com> wrote:
> > > Hi there,
> > >
> > > Can anyone give me a hand? I can't get this to work. I'm tring to run an
> > ant
> > > task written in an external build.xml file:
> > >
> > > <project name="portal-meta">
> > >   <taskdef name="collect-metainfo"
> > >            classname="
> > > com.social_labs.portal.container.tools.ProviderMetaInfoCollector">
> > >     <classpath refid="maven.plugin.classpath"/>
> > >   </taskdef>
> > >
> > >   <target name="meta" description="Compiles the source code">
> > >     <collect-metainfo destdir="...">
> > >       <fileset dir="..."/>
> > >     </collect-metainfo>
> > >   </target>
> > > </project>
> > >
> > > To get this I'm using the maven-antrun-plugin and I followed the
> > > instructions found at
> > > http://maven.apache.org/plugins/maven-antrun-plugin/classpaths.html.
> > > The plugin configuration is as follows.
> > >
> > > <plugin>
> > >         <groupId>org.apache.maven.plugins</groupId>
> > >         <artifactId>maven-antrun-plugin</artifactId>
> > >         <executions>
> > >           <execution>
> > >             <id>compile</id>
> > >             <phase>compile</phase>
> > >             <configuration>
> > >               <tasks>
> > >                 <ant antfile="${basedir}/portal-container.build.xml"
> > > inheritRefs="true">
> > >                   <target name="meta" />
> > >                 </ant>
> > >               </tasks>
> > >             </configuration>
> > >             <goals>
> > >               <goal>run</goal>
> > >             </goals>
> > >           </execution>
> > >         </executions>
> > >         <dependencies>
> > >           <dependency>
> > >             <artifactId>portal-container-impl</artifactId>
> > >             <groupId>com.social_labs.portal</groupId>
> > >             <version>${pom.version}</version>
> > >           </dependency>
> > >         </dependencies>
> > >       </plugin>
> > >
> > > The problem seems to be that the build.xml file doesn't inherits the
> > > references from the POM because I
> > > allways get this error message:
> > >
> > > [ERROR] BUILD ERROR
> > > [INFO]
> > >
> > ----------------------------------------------------------------------------
> > > [INFO] Error executing ant tasks
> > >
> > > Embedded error: The following error occurred while executing this line:
> > > E:\Proyectos\Enterprise Ring System\portal\modules\dao\impl\portal-
> > > container.build.xml:5:
> > > Reference maven.plugin.classpath not found.
> > >
> > > Does anyone know what's happening? Is there another different way to do
> > what
> > > I'm trying?
> > >
> > > Regards,
> > > Alonso
> > >
> > >
> >
> >
> > --
> > I could give you my word as a Spaniard.
> > No good. I've known too many Spaniards.
> >                              -- The Princess Bride
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>


--
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
                             -- The Princess Bride

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


Re: M2 antrun plugin problem

Posted by "A. Alonso Dominguez" <al...@gmail.com>.
Hi again,

I tried with the two different instructions I got, the one from Siegmann and
the other one from Carlos Sanchez. None of them did work.

I also tired to go a bit ahead: I have notice that the "<property ... />"
tag doesn't declares any path-like structure so I changed a bit the response
I got from Siegmann I now the plugin configuration is like this:

<configuration>
 <tasks>
       <path id="maven.plugin.classpath">
            <pathelement location="${maven.plugin.classpath}" />
        </path>
        <ant antfile="${basedir}/portal-container.build.xml"
inheritRefs="true">
             <target name="meta" />
        </ant>
 </tasks>
</configuration>

Now, Maven informs about that will override the reference to "
maven.plugin.classpath" but It eventually fails again:

[INFO] [antrun:run {execution: compile}]
[INFO] Executing tasks
Overriding previous definition of reference to maven.plugin.classpath
[INFO]
----------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
----------------------------------------------------------------------------
[INFO] Error executing ant tasks

Embedded error: The following error occurred while executing this line:
E:\Proyectos\Enterprise Ring System\portal\modules\dao\impl\portal-
container.build.xml:5:
Reference maven.plugin.classpath not found.

Because of this I'm really confused. Thinking about that, what I really
whant is a way to run an Ant task developed by myself.
Does anyone know a way to define that Ant task inside the POM (or in a
different place) so I can configure the plugin like this?:

<configuration>
 <tasks>
       <collect-metainfo destdir="maven.runtime.classpath">
         <fileset dir="maven.compile.classpath"/>
       </collect-metainfo>
 </tasks>
</configuration>

Alonso

2006/4/5, Carlos Sanchez <ca...@apache.org>:
>
> You may need the latest version of the plugin 1.2-SNAPSHOT, building
> it from sources or adding this repository to your pom:
> http://cvs.apache.org/maven-snapshot-repository
>
>
> On 4/5/06, A. Alonso Dominguez <al...@gmail.com> wrote:
> > Hi there,
> >
> > Can anyone give me a hand? I can't get this to work. I'm tring to run an
> ant
> > task written in an external build.xml file:
> >
> > <project name="portal-meta">
> >   <taskdef name="collect-metainfo"
> >            classname="
> > com.social_labs.portal.container.tools.ProviderMetaInfoCollector">
> >     <classpath refid="maven.plugin.classpath"/>
> >   </taskdef>
> >
> >   <target name="meta" description="Compiles the source code">
> >     <collect-metainfo destdir="...">
> >       <fileset dir="..."/>
> >     </collect-metainfo>
> >   </target>
> > </project>
> >
> > To get this I'm using the maven-antrun-plugin and I followed the
> > instructions found at
> > http://maven.apache.org/plugins/maven-antrun-plugin/classpaths.html.
> > The plugin configuration is as follows.
> >
> > <plugin>
> >         <groupId>org.apache.maven.plugins</groupId>
> >         <artifactId>maven-antrun-plugin</artifactId>
> >         <executions>
> >           <execution>
> >             <id>compile</id>
> >             <phase>compile</phase>
> >             <configuration>
> >               <tasks>
> >                 <ant antfile="${basedir}/portal-container.build.xml"
> > inheritRefs="true">
> >                   <target name="meta" />
> >                 </ant>
> >               </tasks>
> >             </configuration>
> >             <goals>
> >               <goal>run</goal>
> >             </goals>
> >           </execution>
> >         </executions>
> >         <dependencies>
> >           <dependency>
> >             <artifactId>portal-container-impl</artifactId>
> >             <groupId>com.social_labs.portal</groupId>
> >             <version>${pom.version}</version>
> >           </dependency>
> >         </dependencies>
> >       </plugin>
> >
> > The problem seems to be that the build.xml file doesn't inherits the
> > references from the POM because I
> > allways get this error message:
> >
> > [ERROR] BUILD ERROR
> > [INFO]
> >
> ----------------------------------------------------------------------------
> > [INFO] Error executing ant tasks
> >
> > Embedded error: The following error occurred while executing this line:
> > E:\Proyectos\Enterprise Ring System\portal\modules\dao\impl\portal-
> > container.build.xml:5:
> > Reference maven.plugin.classpath not found.
> >
> > Does anyone know what's happening? Is there another different way to do
> what
> > I'm trying?
> >
> > Regards,
> > Alonso
> >
> >
>
>
> --
> I could give you my word as a Spaniard.
> No good. I've known too many Spaniards.
>                              -- The Princess Bride
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: M2 antrun plugin problem

Posted by Carlos Sanchez <ca...@apache.org>.
You may need the latest version of the plugin 1.2-SNAPSHOT, building
it from sources or adding this repository to your pom:
http://cvs.apache.org/maven-snapshot-repository


On 4/5/06, A. Alonso Dominguez <al...@gmail.com> wrote:
> Hi there,
>
> Can anyone give me a hand? I can't get this to work. I'm tring to run an ant
> task written in an external build.xml file:
>
> <project name="portal-meta">
>   <taskdef name="collect-metainfo"
>            classname="
> com.social_labs.portal.container.tools.ProviderMetaInfoCollector">
>     <classpath refid="maven.plugin.classpath"/>
>   </taskdef>
>
>   <target name="meta" description="Compiles the source code">
>     <collect-metainfo destdir="...">
>       <fileset dir="..."/>
>     </collect-metainfo>
>   </target>
> </project>
>
> To get this I'm using the maven-antrun-plugin and I followed the
> instructions found at
> http://maven.apache.org/plugins/maven-antrun-plugin/classpaths.html.
> The plugin configuration is as follows.
>
> <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-antrun-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>compile</id>
>             <phase>compile</phase>
>             <configuration>
>               <tasks>
>                 <ant antfile="${basedir}/portal-container.build.xml"
> inheritRefs="true">
>                   <target name="meta" />
>                 </ant>
>               </tasks>
>             </configuration>
>             <goals>
>               <goal>run</goal>
>             </goals>
>           </execution>
>         </executions>
>         <dependencies>
>           <dependency>
>             <artifactId>portal-container-impl</artifactId>
>             <groupId>com.social_labs.portal</groupId>
>             <version>${pom.version}</version>
>           </dependency>
>         </dependencies>
>       </plugin>
>
> The problem seems to be that the build.xml file doesn't inherits the
> references from the POM because I
> allways get this error message:
>
> [ERROR] BUILD ERROR
> [INFO]
> ----------------------------------------------------------------------------
> [INFO] Error executing ant tasks
>
> Embedded error: The following error occurred while executing this line:
> E:\Proyectos\Enterprise Ring System\portal\modules\dao\impl\portal-
> container.build.xml:5:
> Reference maven.plugin.classpath not found.
>
> Does anyone know what's happening? Is there another different way to do what
> I'm trying?
>
> Regards,
> Alonso
>
>


--
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
                             -- The Princess Bride

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