安装JAR从蚂蚁任务内置到本地Maven仓库 [英] install jar built from ant task into local maven repository

查看:228
本文介绍了安装JAR从蚂蚁任务内置到本地Maven仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我想在我的Ant脚本结束时运行命令:

This is the command I want to run at the end of my Ant script:

 mvn install:install-file -Dfile=C:\dev\common\somejar.jar -DgroupId=com.myco.gt -DartifactId=somejar-Dversion=1.0.0 -Dpackaging=jar -DgeneratePOM=true

如果我输入下面的目标在我的Ant脚本的末尾:

If I enter the following target at the end of my Ant script:

<target name='install_mvn_dependencies' depends='build_jars'>
    <exec executable="mvn">
        <arg value="install:install-file"/>
        <arg value="-Dfile=c:\dev\common\somejar.jar"/>
        <arg value ="-DgroupId=com.myco.gt"/>
        <arg value="-DartifactId=somejar"/>
        <arg value="-Dversion=1.2.0"/>
        <arg value="-Dpackaging=jar"/>
        <arg value="-DgeneratePOM=true"/>       
    </exec>   
</target>

我得到 CreateProcess的错误= 2。该系统找不到指定的路径。

即使我可以在命令行中运行MVN。是什么给了?

even though I can run mvn on the command line. What gives?

推荐答案

MVN 命令实际上是一个批处理命令,所以您不能直接执行它。试试这个:

The mvn command is actually a batch command, so you can't execute it directly. Try this:

<exec executable="cmd.exe">
    <arg value="/c"/>
    <arg value="mvn.bat"/>
    <arg value="install:install-file"/>
    <arg value="-Dfile=c:\dev\common\somejar.jar"/>
    <arg value ="-DgroupId=com.myco.gt"/>
    <arg value="-DartifactId=somejar"/>
    <arg value="-Dversion=1.2.0"/>
    <arg value="-Dpackaging=jar"/>
    <arg value="-DgeneratePOM=true"/>       
</exec>   

这篇关于安装JAR从蚂蚁任务内置到本地Maven仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆