Maven 2 exec maven插件希望在我的exec目标中将maven.dependency.classpath作为变量传递 我想在build.xml中定义属性或使用maven.plugin.classpath和maven.dependency.classpath。 我怎么做? 示例代码如下所示。。。 无法工作且无法从my build.xml读取值,请解释我如何执行此操作? org.codehaus.mojo execmaven插件 1.2 安装 安装 执行官 antscript.bat 嗨,肖恩·帕特里克·弗洛伊德, 是的,我尝试使用maven antrun插件,但我无法在其中设置JDK 1.4.2版本。我试图指定所有可能的方法来应用JDK版本1.4.2,但它仍然使用tools.jar或JDK版本,maven.bat文件正在使用它们(JDK 1.5) 我在MAVEN-ANTRUN-PLUGIN中使用了以下代码,如下所示。 org.apache.maven.plugins maven antrun插件 1.6 安装 安装 跑 ${java版本} ${java版本} ${java版本} ${java.1.4.2.home}/bin/javac sun.jdk 工具 1.4.2 系统 ${java.1.4.2.home}/lib/tools.jar com.sun rt ${java版本} 系统 ${java.1.4.2.home}/jre/lib/rt.jar 这就是为什么我选择exec目标,我的系统JAVA_HOME是1.4.2,如果我有我需要的所有依赖项,它就能够执行它。 请帮帮我。 谢谢
Maven 2 exec maven插件希望在我的exec目标中将maven.dependency.classpath作为变量传递 我想在build.xml中定义属性或使用maven.plugin.classpath和maven.dependency.classpath。 我怎么做? 示例代码如下所示。。。 无法工作且无法从my build.xml读取值,请解释我如何执行此操作? org.codehaus.mojo execmaven插件 1.2 安装 安装 执行官 antscript.bat 嗨,肖恩·帕特里克·弗洛伊德, 是的,我尝试使用maven antrun插件,但我无法在其中设置JDK 1.4.2版本。我试图指定所有可能的方法来应用JDK版本1.4.2,但它仍然使用tools.jar或JDK版本,maven.bat文件正在使用它们(JDK 1.5) 我在MAVEN-ANTRUN-PLUGIN中使用了以下代码,如下所示。 org.apache.maven.plugins maven antrun插件 1.6 安装 安装 跑 ${java版本} ${java版本} ${java版本} ${java.1.4.2.home}/bin/javac sun.jdk 工具 1.4.2 系统 ${java.1.4.2.home}/lib/tools.jar com.sun rt ${java版本} 系统 ${java.1.4.2.home}/jre/lib/rt.jar 这就是为什么我选择exec目标,我的系统JAVA_HOME是1.4.2,如果我有我需要的所有依赖项,它就能够执行它。 请帮帮我。 谢谢,maven-2,ant,maven,maven-3,exec-maven-plugin,Maven 2,Ant,Maven,Maven 3,Exec Maven Plugin,maven.plugin.classpath等是仅在中定义的变量。exec插件不知道这些值。而且,一开始就不可能这样做,因为您正在调用一个外部.bat文件并因此启动一个新进程 如果我是你,我会使用antrun插件。有关详细信息,请参阅 更新:好的,现在我看到你的问题了。不,您不能使用不同的JDK,因为antrun在同一个vm中工作。因此,要么您需要切换JDK maven使用的方式,要么您实际上需要使用exec maven插件。在后一种情况下,您必须使用 在ant端,读取someFile.tx
maven.plugin.classpath
等是仅在中定义的变量。exec插件不知道这些值。而且,一开始就不可能这样做,因为您正在调用一个外部.bat文件并因此启动一个新进程
如果我是你,我会使用antrun插件。有关详细信息,请参阅
更新:好的,现在我看到你的问题了。不,您不能使用不同的JDK,因为antrun在同一个vm中工作。因此,要么您需要切换JDK maven使用的方式,要么您实际上需要使用exec maven插件。在后一种情况下,您必须使用
在ant端,读取
someFile.txt
的内容作为属性,并从中创建类路径。或者您可以在命令行参数中找到。是的我找到的正确答案是使用支持JDK 1.4.2的MAVEN版本。所以我必须使用支持JDK1.4.2的apache-maven-2.0.11
谢谢大家的回答。@user886614是否可以使用maven antrun插件调用需要Java环境的Ant任务?您可以使用antrun插件中提供的maven类路径属性为任务提供依赖项jar位置。
I want to define property or want to use maven.plugin.classpath and maven.dependency.classpath in my build.xml.
How can i do it ?
Sample code is as below...
<property> </property> is not working and not able to read the values from my build.xml so please explain me how can i do it ?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<property name="plugin_classpath" refid="maven.plugin.classpath" />
<property name="maven_dependency_classpath" refid="maven.dependency.classpath" />
<executable>antscript.bat</executable> <!-- ant -f build.xml build -->
</configuration>
</plugin>
Hi Sean Patrick Floyd,
Yes i tried using maven-antrun-plugin but i am not able to setup JDK 1.4.2 version in it. I am trying to specify all possible way to apply JDK version 1.4.2 but it's still taking tools.jar or JDK version, Which maven.bat file is using (jdk 1.5)
I was using following code in MAVEN-ANTRUN-PLUGIN as below code.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
<compilerVersion>${java-version}</compilerVersion>
<executable>${java.1.4.2.home}/bin/javac</executable>
<target>
<property name="plugin_classpath" refid="maven.plugin.classpath" />
<property name="maven_dependency_classpath" refid="maven.dependency.classpath" />
<ant antfile="ant_build.xml" />
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>sun.jdk</groupId>
<artifactId>tools</artifactId>
<version>1.4.2</version>
<scope>system</scope>
<systemPath>${java.1.4.2.home}/lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>rt</artifactId>
<version>${java-version}</version>
<scope>system</scope>
<systemPath>${java.1.4.2.home}/jre/lib/rt.jar</systemPath>
</dependency>
</dependencies>
</plugin>
That's why i choose exec GOAL where my SYSTEM JAVA_HOME is 1.4.2 and it's able to execute it if i have all dependencies which i needed.
Please help me out.
Thanks.