添加maven-antrun-plugin

时间:2018-10-10 15:32:32

标签: maven ant maven-antrun-plugin

我有一个Ant任务,可以通过使用maven-antrun-plugin在maven中执行。这些数据使用XmlTask从XML文件中读取一些值。该任务失败,并出现类装入错误,因为此tas的定义在单独的jar中。如何将这个jar添加到类路径中?我曾尝试将此jar添加到Maven和Ant的lib目录中,但是仍然出现此错误。

下面是我pom.xml的一部分,错误是:

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
    <execution>
        <id>versionConsistency</id>
        <phase>package</phase>
        <goals>
            <goal>run</goal>
        </goals>
        <configuration>
            <target>
                <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>
                <xmltask source="Upgrade.xml">
                    <copy path="component/versions/version/@number" property="fVer" />
                </xmltask>
                <property name="pVer" value = "${project.version}" />
                <script language="javascript">
                    <![CDATA[
                    fVer = project.getProperty('fVer');
                    pVer = project.getProperty('pVer');
                    if( fVer == pVer){
                        project.setProperty('isVerConsistent','true');
                    }else if (pVer.substring(0, pVer.search("-")) == fVer){
                        project.setProperty('isVerConsistent','true');
                    }else{
                        project.setProperty('isVerConsistent','false');
                        var fail = project.createTask("fail");
                        fail.setMessage("Project version and version in Upgrade.xml do not match");
                        fail.perform();

                    }
                ]]>
                </script>
            </target>
        </configuration>
    </execution>
</executions>

0 个答案:

没有答案