You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by sc...@explosion-it.net on 2005/11/15 19:28:57 UTC

Classpath in antrun plugin

Hi All

How do I set up the classpath for ant tasks to contain the dependencies
specified in my POM

Kind regards

Stephen

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


Re: Classpath in antrun plugin

Posted by Drew Hite <hi...@gmail.com>.
A few days ago it was stated on this list that the antrun plugin exposes
maven.dependency.classpath to ant as a ref. It can be referenced with:
<property name="depClasspath" refid="maven.dependency.classpath" />

So if you could have something like this in your build.xml

<project default="create_atts">
<property name="src.path" value="src"/>
<taskdef classpath="${depClasspath}"
resource="org/apache/commons/attributes/anttasks.properties">
</taskdef>
<target name="create_atts">
<attribute-compiler destdir="${src.path}">
<fileset dir="${src.path}" />
</attribute-compiler>
</target>
</project>

and something like this in your pom.xml..

<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<execution>
<phase>generate-sources</phase>
<configuration>
<tasks>
<property name="depClasspath"
refid="maven.dependency.classpath" />
<ant antfile="build.xml" dir="."
target="create_atts" inheritRefs="true" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Seems to work for me...

Drew

On 11/15/05, scowx@explosion-it.net <sc...@explosion-it.net> wrote:
>
> Hi Alexandre
>
> Thanks for your reply. This is what I would have assumed would be the
> case but
> I am not getting this behaviour.
>
> Here is the relevant section of the pom
>
> <dependencies>
> <!-- Dependency for Oracle JDBC -->
> <dependency>
> <groupId>ojdbc</groupId>
> <artifactId>ojdbc</artifactId>
> <version>14</version>
> <scope>compile</scope>
> </dependency>
> </dependencies>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-antrun-plugin</artifactId>
> <executions>
> <execution>
> <phase>test</phase>
> <configuration>
> <tasks>
> <ant antfile="build.xml" dir="src/main" target="db-build"
> inheritRefs="true"/>
> </tasks>
> </configuration>
> <goals>
> <goal>run</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
>
> And this is the task that is being run in the build.xml file
>
> <sql src="oracle/bla_bla_bla.sql"
> classpath="${jdbcfile}"
> driver="${driver}"
> url="${url}"
> userid="${usr}"
> password="${pass}"/>
>
>
> Any ideas?
>
> Steve
>
> Quoting Alexandre Poitras <al...@gmail.com>:
>
> >> From what I recall, the classpath seemed to be already set up for the
> ant
> > plugin, including the dependencies declared in the pom.
> >
> > On 11/15/05, scowx@explosion-it.net <sc...@explosion-it.net> wrote:
> >>
> >> Hi All
> >>
> >> How do I set up the classpath for ant tasks to contain the dependencies
> >> specified in my POM
> >>
> >> Kind regards
> >>
> >> Stephen
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
> >
> > --
> > Alexandre Poitras
> > Québec, Canada
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Classpath in antrun plugin

Posted by sc...@explosion-it.net.
Hi Alexandre

Thanks for your reply.  This is what I would have assumed would be the 
case but
I am not getting this behaviour.

Here is the relevant section of the pom

<dependencies>
    <!-- Dependency for Oracle JDBC -->
    <dependency>
    	<groupId>ojdbc</groupId>
		<artifactId>ojdbc</artifactId>
		<version>14</version>
        <scope>compile</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>test</phase>
            <configuration>
              <tasks>
                 <ant antfile="build.xml" dir="src/main" target="db-build"
inheritRefs="true"/>
                </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

And this is the task that is being run in the build.xml file

<sql src="oracle/bla_bla_bla.sql"
     classpath="${jdbcfile}"
     driver="${driver}"
    url="${url}"
    userid="${usr}"
    password="${pass}"/>


Any ideas?

Steve

Quoting Alexandre Poitras <al...@gmail.com>:

>> From what I recall, the classpath seemed to be already set up for the ant
> plugin, including the dependencies declared in the pom.
>
> On 11/15/05, scowx@explosion-it.net <sc...@explosion-it.net> wrote:
>>
>> Hi All
>>
>> How do I set up the classpath for ant tasks to contain the dependencies
>> specified in my POM
>>
>> Kind regards
>>
>> Stephen
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
> --
> Alexandre Poitras
> Québec, Canada
>




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


Re: Classpath in antrun plugin

Posted by Alexandre Poitras <al...@gmail.com>.
>From what I recall, the classpath seemed to be already set up for the ant
plugin, including the dependencies declared in the pom.

On 11/15/05, scowx@explosion-it.net <sc...@explosion-it.net> wrote:
>
> Hi All
>
> How do I set up the classpath for ant tasks to contain the dependencies
> specified in my POM
>
> Kind regards
>
> Stephen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
Alexandre Poitras
Québec, Canada