maven-antrun-plugin返回插件未找到

时间:2015-10-20 09:43:41

标签: maven plugins ant maven-antrun-plugin

我关注了帖子install jar built from ant task into local maven repository

我无法弄清楚问题是什么,但这根本行不通。我不知道为什么他们使用<arg value="mvn.bat"/>代替<arg value="mvn "/> 无论如何,我有以下xml文件:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.8</version>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <configuration>  
         <target name="mvn">
          <property environment="env" />
          <property name="appname" value="hellojavaworld" />
           <exec dir="." executable="cmd">
             <arg value="/c"/>
             <arg value="mvn "/>
             <arg value="install:install-file"/>
             <arg value="-Dfile=c:\Documents and Settings\bbb\workspace\HelloServlet\hellojavaworld\src\main\java\hellojavaworld.bin\hellojavaworld.jar"/>
             <arg value ="-DgroupId=${appname}"/>
             <arg value="-DartifactId=${appname}"/>
             <arg value="-Dversion=1.0"/>
             <arg value="-Dpackaging=jar"/>
             <arg value="-DgeneratePOM=true"/>  
           </exec>
         </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>
    </plugins>
</build>

它返回错误:

  

解析插件版本时出错&#39;安装:install-file -D   文件= C&#39;来自存储库[local(C:\ Documents and Settings \ bbb.m2 \ repository),中心(https://repo.maven.apache.org/maven2)]:插件在任何插件库中找不到

1 个答案:

答案 0 :(得分:1)

您的问题非常微妙,在这种情况下错误消息无效。

问题来自maven-antrun-plugin的以下配置:

<arg value="mvn "/>

应该是

<arg value="mvn"/>

最后的空格被编码为%20,这会让事情变得混乱。我注意到了,因为在运行配置时,我看到了以下日志:

[exec] Downloading: https://repo.maven.apache.org/maven2/%20install/install-file%20-Dfile=c/maven-metadata.xml

请注意,在此日志中,Maven正在尝试查找install-file%20插件,这显然不起作用。

相关问题