0
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.
4

2 に答える 2

1

maven.plugin.classpathなどは、maven-antrun-pluginのみで定義されている変数です。exec プラグインはこれらの値を認識しません。また、外部の .bat ファイルを呼び出して新しいプロセスを開始しているため、そもそもそのようにすることはできません。

私があなたなら、antrun プラグインを使用します。詳しくはご利用ページをご覧ください。


更新:わかりました、今私はあなたの問題を見ました。いいえ、antrun は同じ vm 内で動作するため、別の JDK を使用することはできません。したがって、JDK maven の使用を切り替えるか、実際には exec-maven-plugin を使用する必要があります。後者の場合、 ant 側で and を使用して、の内容をプロパティとして読み取り、そこからクラスパスを作成する必要があります。または、コマンド ライン引数で変数プレースホルダーを使用できます。
dependency:build-classpath -DoutputFile=someFile.txt
someFile.txt%classpath

于 2011-08-18T22:32:32.667 に答える
0

はい、私が見つけた正解は、JDK 1.4.2 をサポートする MAVEN バージョンを使用することです。したがって、JDK 1.4.2 をサポートする apache-maven-2.0.11 を使用する必要があります。

回答ありがとうございます。

于 2011-08-22T16:29:04.907 に答える