maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anders Hammar <and...@hammar.net>
Subject Re: Inline Ant tasks not working - Namespace problem?
Date Wed, 03 Nov 2010 08:44:24 GMT
The dependency should be for the antrun-plugin. The definition of jacocoant
as a plugin is just wrong I think, it's not a plugin.
Also, I don't think you should put any xmlns in the maven project tag. Maven
is not using this, it's the antrun-plugin (which is a separated space).

Maybe you want to take this to the sonar list and ask them as it's their
stuff?

/Anders

On Wed, Nov 3, 2010 at 07:08, Hari shankar <harshan87@gmail.com> wrote:

> Thanks Anders.
>
> I installed jacocoant.jar to local repo now and ensured plugin dependencies
> are resolved correctly using dependency:resolve-plugins goal. It went fine.
> But upon mvn clean package, the ant task still throws the same error.
>
> This is the modified pom.xml. (Also i have added plugin dependencies in 2
> places - one for antrun plugin itself and other as normal build dependency,
> not sure which one is right). Any pointers?
>
> <build>
>        <plugins>
>            <plugin>
>                <artifactId>maven-antrun-plugin</artifactId>
>                <version>1.6</version>
>                <executions>
>                    <execution>
>                        <phase>package</phase>
>                        <configuration>
>
>                            <target>
>                             <echo message="Base dir:
> ${maven.plugin.classpath}" />
>                                 <taskdef uri="antlib:org.jacoco.ant"
> resource="org/jacoco/ant/antlib.xml"
>
>  *classpathref="maven.plugin.classpath">*
>                                    *<!--
>                                         <classpath
>
> path="C:\SOFTWARES\JAVA\Java-external-jars\Jacoco\lib\jacocoant.jar"
>                                        />
>                                    -->*
>                                </taskdef>
>
>                                 <!--
>                                    <ant antfile="C:/build.xml"> <target
> name="report" /> </ant>
>                                -->
>
>
>                                <jacoco:report>
>
>                                    <executiondata>
>                                        <file file="C:/coverage.exec" />
>                                    </executiondata>
>
>                                    <structure name="Example Project">
>                                        <classfiles>
>                                            <fileset
>
>
> dir="C:\Workspaces\all-learning\tycho-maven-headless-build\com.ebay.sample.main\bin"
> />
>                                        </classfiles>
>                                        <sourcefiles encoding="UTF-8">
>                                            <fileset
>
>
> dir="C:\Workspaces\all-learning\tycho-maven-headless-build\com.ebay.sample.main\src"
> />
>                                        </sourcefiles>
>                                    </structure>
>
>                                    <html destdir="C:/report" />
>
>                                </jacoco:report>
>                            </target>
>                        </configuration>
>                        <goals>
>                            <goal>run</goal>
>                        </goals>
>                    </execution>
>                </executions>
>                * <dependencies>
>                    <dependency>
>                        <groupId>org.sonar</groupId>
>                        <artifactId>jacocoant</artifactId>
>                        <version>0.4.1</version>
>                    </dependency>
>                </dependencies>
>            </plugin>
>            <plugin>
>                <groupId>org.sonar</groupId>
>                <artifactId>jacocoant</artifactId>
>                <version>0.4.1</version>
>            </plugin>*
>        </plugins>
>    </build>
>
>
> Also this is the xmlns in project tag:
>
> project
>    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd"
>    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
>    xmlns:jacoco="antlib:org.jacoco.ant">
>
>
> Thanks,
> Hari
>
> On Tue, Nov 2, 2010 at 3:43 PM, Anders Hammar <anders@hammar.net> wrote:
>
> >
> >
> http://maven.apache.org/plugins/maven-antrun-plugin/examples/customTasks.html
> >
> > You need to define a plugin dependency to jacocoant.jar. If that artifact
> > is
> > not already in the repo, you need to ad it to your repo manager.
> >
> > /Anderfs
> >
> > On Tue, Nov 2, 2010 at 10:59, Hari shankar <harshan87@gmail.com> wrote:
> >
> > > I got a ant build.xml invoked properly via maven antrun plugin but when
> i
> > > define it inline, it doesn't work. Please assist.
> > > I think it has to do with xmlns but not sure where to define it
> properly.
> > > (To be specific am using a jacoco ant task for code coverage as
> described
> > > here <http://www.eclemma.org/jacoco/trunk/doc/ant.html>)
> > >
> > > The error that i got is
> > >
> > > *[ERROR] Failed to execute goal
> > > org.apache.maven.plugins:maven-antrun-plugin:1.6:
> > > run (default) on project xxx.sample.suite: An Ant BuildException has
> > occure
> > > d: The prefix "jacoco" for element "jacoco:report" is not bound. ->
> [Help
> > > 1]
> > > *
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <project
> > >    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > > http://maven.apache.org/xsd/maven-4.0.0.xsd"
> > >    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> > > http://www.w3.org/2001/XMLSchema-instance"
> > > *    xmlns:jacoco="antlib:org.jacoco.ant">*
> > >    <modelVersion>4.0.0</modelVersion>
> > >
> > >    <groupId>xxx.sample</groupId>
> > >    <artifactId>xxx.sample.suite</artifactId>
> > >    <version>1.0.0-SNAPSHOT</version>
> > >    <packaging>jar</packaging>
> > >
> > >    <build>
> > >        <plugins>
> > >            <plugin>
> > >                <artifactId>maven-antrun-plugin</artifactId>
> > >                <version>1.6</version>
> > >                <executions>
> > >                    <execution>
> > >                        <phase>package</phase>
> > >                        <configuration>
> > >
> > >                            <target>
> > >
> > >                             <taskdef uri="antlib:org.jacoco.ant"
> > > resource="org/jacoco/ant/antlib.xml">
> > >                                    <classpath
> > >
> > > path="C:\SOFTWARES\JAVA\Java-external-jars\Jacoco\lib\jacocoant.jar" />
> > >                            </taskdef>
> > >
> > >                                <echo message="Base dir: ${basedir}" />
> > >
> > >
> > >                                    <jacoco:report>
> > >
> > >                                        <executiondata>
> > >                                            <file
> file="C:/coverage.exec"
> > />
> > >                                        </executiondata>
> > >
> > >                                        <structure name="Example
> Project">
> > >                                            <classfiles>
> > >                                                <fileset
> > >                                                    dir="C:\..\bin" />
> > >                                            </classfiles>
> > >                                            <sourcefiles
> encoding="UTF-8">
> > >                                                <fileset
> > >                                                    dir="C:\..\src" />
> > >                                            </sourcefiles>
> > >                                        </structure>
> > >
> > >                                        <html destdir="C:/report" />
> > >
> > >                                    </jacoco:report>
> > >                            </target>
> > >                        </configuration>
> > >                        <goals>
> > >                            <goal>run</goal>
> > >                        </goals>
> > >                    </execution>
> > >                </executions>
> > >            </plugin>
> > >
> > >        </plugins>
> > >    </build>
> > > </project>
> > >
> > > Thanks,
> > > Hari
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message