Domanda

Ho il seguente nel mio pom:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-ant-plugin</artifactId>
    <version>2.3</version>
    <configuration>
       <target>
          <echo
            message="hello ant, from Maven!" />
          <echo>Maybe this will work?</echo>
       </target>
    </configuration>
</plugin>

Tuttavia, quando corro 'mvn antrun: run' ottengo questo:

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'antrun'.
[INFO] ------------------------------------------------------------------------
[INFO] Building myProject
[INFO]    task-segment: [antrun:run]
[INFO] ------------------------------------------------------------------------
[INFO] [antrun:run {execution: default-cli}]
[INFO] Executing tasks
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri Sep 24 13:33:14 PDT 2010
[INFO] Final Memory: 16M/28M
[INFO] ------------------------------------------------------------------------

Come mai l'eco del non si presentano?

TIA

È stato utile?

Soluzione

Poiché si suppone di utilizzare la Maven AntRun plugin se si desidera di eseguire le attività Ant, non il Maven Ant Plugin (che viene utilizzato per < em> generare file di generazione per Ant 1.6.2 o superiore dal POM ). Modifica la configurazione del plugin, come di seguito:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.5</version>
    <configuration>
      <target>
        <echo message="hello ant, from Maven!"/>
        <echo>Maybe this will work?</echo>
      </target>
    </configuration>
  </plugin>

E invocando antrun:run funziona:

$ mvn antrun:run 
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Q3790798 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-antrun-plugin:1.5:run (default-cli) @ Q3790798 ---
[INFO] Executing tasks

main:
     [echo] hello ant, from Maven!
     [echo] Maybe this will work?
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
...

Altri suggerimenti

Assicurarsi maven-antrun-plugin utilizza una versione abbastanza recente.

Un BOM estranei nel mio progetto stava chiudendo a 1,3, e <echo> è stato ignorato. Dopo aver rimosso la distinta base e specificando 1.7 per antrun, gli echi hanno lavorato.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top