在Maven内调用Maven

问题描述 投票:0回答:1

mavenized一个项目,它基本上是一个bash脚本。我这样做是因为脚本具有可以由maven进行管理的依赖项,并且因为在脚本中使用maven来触发某些插件执行非常方便。在我的脚本中,我做这样的事情:

mvn -f ../pom.xml compile some_usefull_plugin@my_execution

如果直接调用该脚本,一切正常,但是如果我尝试使用以下插件通过Maven mvn test运行该脚本,则]:

         <plugin>
            <artifactId>exec-maven-plugin</artifactId>
            <groupId>org.codehaus.mojo</groupId>
            <version>1.6.0</version>
            <executions>
                <execution>
                    <id>my_script</id>
                    <phase>test</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>${project.basedir}/src/my_script.sh</executable>
                    </configuration>
                </execution>
            </executions>
        </plugin>

然后在从脚本触发Maven的时刻失败:mvn: command not found

我已经将一个项目基本化为bash脚本。我这样做是因为脚本具有可以由maven进行管理的依赖项,并且因为在脚本中使用maven来触发...

bash maven
1个回答
0
投票

使用AntRun插件效果很好

© www.soinside.com 2019 - 2024. All rights reserved.