2011-06-07 15 views
10

मैवेन एंट्रुन प्लगइन 1.6 का उपयोग कर रहा हूं और उनके उदाहरण से मैं निम्नलिखित चींटी कार्य को निष्पादित करने के लिए कोड नहीं कर सकता।मैवेन एंटरन कार्य निष्पादित नहीं कर रहे हैं

उदाहरण यूआरएल: रन: http://maven.apache.org/plugins/maven-antrun-plugin/examples/classpaths.html

मैं बस जब मैं mvn antrun निष्पादित निम्न संदेश मिलता है। कोई चींटी लक्ष्य परिभाषित नहीं किया गया - SKIPPED

मैं क्या गलत कर रहा हूं?

 <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.6</version> 
      <executions> 
       <execution> 
        <id>compile</id> 
        <phase>compile</phase> 
        <configuration> 
         <target> 
          <property name="compile_classpath" refid="maven.compile.classpath" /> 
          <property name="runtime_classpath" refid="maven.runtime.classpath" /> 
          <property name="test_classpath" refid="maven.test.classpath" /> 
          <property name="plugin_classpath" refid="maven.plugin.classpath" /> 

          <echo message="compile classpath: ${compile_classpath}" /> 
          <echo message="runtime classpath: ${runtime_classpath}" /> 
          <echo message="test classpath: ${test_classpath}" /> 
          <echo message="plugin classpath: ${plugin_classpath}" /> 
         </target> 
        </configuration> 
        <goals> 
         <goal>run</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 

उत्तर

7

चूंकि आप अपने pom.xml में Maven antrun प्लगइन कॉन्फ़िगर किया है, तो आप केवल प्लगइन के लिए कॉन्फ़िगर जीवन चक्र लक्ष्य कॉल करने की आवश्यकता:

यहाँ मेरी पोम है।

इस मामले में

mvn compile

यह आवश्यक कार्रवाई करेंगे।

+0

धन्यवाद! यह पोम को कॉल करने के बारे में एक गलतफहमी थी। –

21

इस

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.7</version> 
      <executions> 
       <execution> 
        <id>default-cli</id> 
        <configuration> 
         <target> 
          <property name="compile_classpath" refid="maven.compile.classpath" /> 
          <property name="runtime_classpath" refid="maven.runtime.classpath" /> 
          <property name="test_classpath" refid="maven.test.classpath" /> 
          <property name="plugin_classpath" refid="maven.plugin.classpath" /> 

          <echo message="compile classpath: ${compile_classpath}" /> 
          <echo message="runtime classpath: ${runtime_classpath}" /> 
          <echo message="test classpath: ${test_classpath}" /> 
          <echo message="plugin classpath: ${plugin_classpath}" /> 
         </target> 
        </configuration> 
        <goals> 
         <goal>run</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

टिप्पणी आईडी

<id>default-cli</id> 

इस तरह से करने के लिए

mvn antrun:run 

कारण कोशिश करते हैं और चलाने के आदेश: यदि आप नहीं चाहते कि वास्तव में करना चाहते हैं " संकलित करें ", कुछ और निष्पादित करने के लिए" एमवीएन संकलन "चलाना काउंटर उत्पादक हो सकता है।

+0

कुछ घंटों बाद Google के बहुत सारे, यह पोस्ट मेरा दिन बचाता है। धन्यवाद। किसी को पता है कि antrun का उपयोग क्यों करें: run @ custom_id काम नहीं करता है? '[ERROR] लक्ष्य 'रन @ कॉपी' नहीं ढूंढ सका <- मेरे मामले में custom_id = copy – Vielinko

+0

@ सुविधा मैवेन 3.3.1 में लागू की गई थी। आप शायद पुराने संस्करण चला रहे हैं। Https://issues.apache.org/jira/browse/MNG-5768 देखें – TikiTavi

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