2011-01-10 15 views
5

खोजने में असमर्थ मैं मैवेन को कुछ विरासत कोड के लिए एक एंट बिल्ड बनाने की कोशिश कर रहा हूं। चींटी निर्माण चींटी के माध्यम से सही ढंग से बनाता है। लेकिन जब मैं Maven चींटी प्लगइन का उपयोग कर इसे कहते है, यह निम्न त्रुटि के साथ विफल:मैवेन एंटी बिल्ड अपवाद मैवेन-एंट्रून-प्लगइन के साथ ... javac compiler

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run  (default) on project CoreServices: An Ant BuildException has occured: The following error occurred while executing this line: 
[ERROR] C:\dev\projects\build\build.xml:158: The following error occurred while executing this line: 
[ERROR] C:\dev\projects\build\build.xml:62: The following error occurred while executing this line: 
[ERROR] C:\dev\projects\build\build.xml:33: The following error occurred while executing this line: 
[ERROR] C:\dev\projects\ods\build.xml:41: Unable to find a javac compiler; 
[ERROR] com.sun.tools.javac.Main is not on the classpath. 
[ERROR] Perhaps JAVA_HOME does not point to the JDK. 
[ERROR] It is currently set to "C:\bea\jdk150_11\jre" 

मेरे javac सेल्सियस पर मौजूद है: \ BEA के \ jdk150_11 \ बिन और यह अन्य सभी बातों के लिए काम करता है। मुझे यकीन नहीं है कि मैवेन को जावा-एचओएमई का यह संस्करण कहां मिल रहा है। विंडोज़ पर्यावरण चर में जावा-एचओएमई सी: \ बीएए \ jdk150_11 \ जैसा होना चाहिए जैसा कि होना चाहिए।

Maven कोड है कि मैं फोन करने के लिए build.xml

<build> 
    <plugins> 
    <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-antrun-plugin</artifactId> 
    <version>1.6</version> 

    <executions> 
      <execution> 
      <phase>install</phase> 
      <configuration> 

       <target> 
    <ant antfile="../build/build.xml" target="deliver" > 
    </ant> 
       </target> 
      </configuration> 
      <goals> 
       <goal>run</goal> 
      </goals> 
      </execution> 
     </executions> 
    </plugin> 
    </plugins> 
    </build> 

उत्तर

15

पहली बात है उपयोग कर रहा हूँ: क्यों आप compile में install चरण में अपने चींटी स्क्रिप्ट को निष्पादित और क्यों नहीं करते?

दूसरी बात: आपकी समस्या इस तथ्य के कारण हो सकती है कि मैवेन जेडीके के बजाय जेआरई निष्पादित करता है, इस तथ्य के बावजूद कि आपका जावा-एचओएमई जेडीके को इंगित करता है। इसे ठीक करने के लिए आपको maven-antrun-plugin के लिए निर्भरता मैन्युअल रूप से समायोजित करना होगा। यह सिर्फ एक उदाहरण है:

<plugin> 
    <artifactId>maven-antrun-plugin</artifactId> 
    <version>1.6</version> 
    <dependencies> 
     <dependency> 
      <groupId>com.sun</groupId> 
      <artifactId>tools</artifactId> 
      <version>1.5.0</version> 
      <scope>system</scope> 
      <systemPath>${java.home}/../lib/tools.jar</systemPath> 
     </dependency> 
    </dependencies> 
    <executions> 
     <execution> 
      <phase>compile</phase> 
      <configuration><target><ant/></target></configuration> 
      <goals><goal>run</goal></goals> 
     </execution> 
    </executions> 
</plugin> 
+4

फ़िक्स लिंक टूटा हुआ है। मुझे लगता है कि यही कारण है कि वे जवाब के साथ-साथ लिंक में विस्तार डालने की सलाह देते हैं। – wrgrs

+2

@ लुकाज़ - आपको या तो इस जवाब को ठीक करने या इसे हटाने की आवश्यकता है, यह बहुत बेकार लिंक है जो अब केवल एक मृत लिंक के साथ जवाब दे रहा है! –

+1

@JarrodRoberson इसे इंगित करने के लिए धन्यवाद। मैं प्लगइन के लिए नमूना विन्यास चिपकाया। – Lukasz

संबंधित मुद्दे