2016-11-27 9 views
0

を私はアリmavenのは、失敗したプラグイン - 実行する@ hbm2java

MVN antrunこのコマンドを実行すると:私はANT_HOMEをANT 1.8をインストールし、設定した

[INFO] Scanning for projects... 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building ciccio 1.0 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-antrun-plugin:1.8:run (hbm2java) @ ciccio --- 
Downloading: https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.9.4/ant-1.9.4.pom 
Downloaded: https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.9.4/ant-1.9.4.pom (10 KB at 9.5 KB/sec) 
Downloading: https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.9.4/ant-1.9.4.jar 
Downloaded: https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.9.4/ant-1.9.4.jar (1972 KB at 1036.8 KB/sec) 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 8.267 s 
[INFO] Finished at: 2016-11-27T23:32:16+01:00 
[INFO] Final Memory: 15M/144M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (hbm2java) on project ciccio: An Ant BuildException has occured: The following error occurred while executing this line: 
[ERROR] jar:file:/C:/Users/ciro/.m2/repository/org/apache/maven/plugins/maven-antrun-plugin/1.8/maven-antrun-plugin-1.8.jar!/org/apache/maven/ant/tasks/antlib.xml:24: The following error occurred while executing this line: 
[ERROR] jar:file:/C:/Users/ciro/.m2/repository/org/apache/ant/ant/1.9.4/ant-1.9.4.jar!/org/apache/tools/ant/antlib.xml:37: Could not create task or type of type: componentdef. 
[ERROR] 
[ERROR] Ant could not find the task or a class this task relies upon. 
[ERROR] 
[ERROR] This is common and has a number of causes; the usual 
[ERROR] solutions are to read the manual pages then download and 
[ERROR] install needed JAR files, or fix the build file: 
[ERROR] - You have misspelt 'componentdef'. 
[ERROR] Fix: check your spelling. 
[ERROR] - The task needs an external JAR file to execute 
[ERROR] and this is not found at the right place in the classpath. 
[ERROR] Fix: check the documentation for dependencies. 
[ERROR] Fix: declare the task. 
[ERROR] - The task is an Ant optional task and the JAR file and/or libraries 
[ERROR] implementing the functionality were not found at the time you 
[ERROR] yourself built your installation of Ant from the Ant sources. 
[ERROR] Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the 
[ERROR] task and make sure it contains more than merely a META-INF/MANIFEST.MF. 
[ERROR] If all it contains is the manifest, then rebuild Ant with the needed 
[ERROR] libraries present in ${ant.home}/lib/optional/ , or alternatively, 
[ERROR] download a pre-built release version from apache.org 
[ERROR] - The build file was written for a later version of Ant 
[ERROR] Fix: upgrade to at least the latest release version of Ant 
[ERROR] - The task is not an Ant core or optional task 
[ERROR] and needs to be declared using <taskdef>. 
[ERROR] - You are attempting to use a task defined using 
[ERROR] <presetdef> or <macrodef> but have spelt wrong or not 
[ERROR] defined it at the point of use 
[ERROR] 
[ERROR] Remember that for JAR files to be visible to Ant tasks implemented 
[ERROR] in ANT_HOME/lib, the files must be in the same directory or on the 
[ERROR] classpath 
[ERROR] 
[ERROR] Please neither file bug reports on this problem, nor email the 
[ERROR] Ant mailing lists, until all of these causes have been explored, 
[ERROR] as this is not an Ant bug. 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 

このエラーを得た実行する@ hbm2java

をウィンドウのパスの中にbinフォルダを置く。

あなたがしてはいけないことをしようとしているような気分になります。たとえば、私はリポジトリとしてant apacheのバージョン1.9をダウンロードしていますが、なぜそれがわかりません。その後、

編集

おかげで、私は私のマシンのアリにインストールされているという事実を無視し、私が述べたことを確認してください。私はバージョン1.9のjarファイルの名前を1.8に変更しました。すべてが完璧に機能します。しかし、これらの手口なしですべてがうまくいくことが良いでしょう。

+0

から使用依存関係のバージョンです。また、1.8より最近のAntが必要だと思います。なぜAntrunを使い始めるのですか? – Tunaki

+0

すべての人に感謝して投稿しました – ciro

+0

Antを経由する代わりにMavenプラグインを直接使用してみませんか? http://stackoverflow.com/a/1900320/1743880 – Tunaki

答えて

0

iポストright pom。

問題は、あなたの `のmaven-antrun-Plugin`をコンフィギュレーションを投稿してくださいツール

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.7</source> 
       <target>1.7</target> 
      </configuration> 
     </plugin> 

     <plugin> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.8</version> 
      <executions> 
       <execution> <!--mvn antrun:[email protected]> 
        <id>hbm2java</id> 
        <phase>none</phase> 
        <configuration> 
         <target> 
          <echo message="Start generating entities .."/> 
          <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"/> 
          <hibernatetool> 
           <jdbcconfiguration 
             revengfile="src/main/resources/hibernate.reveng.xml" 
             packagename="it.ciccio.test" 

             detectmanytomany="true" 
             configurationfile="src/main/resources/hibernate.cfg.xml"/> 
           <hbm2java 
             destdir="src/main/java/" 
             jdk5="true" 
             ejb3="true" 

           /> 
          </hibernatetool> 
          <echo message="End generating entities"/> 
         </target> 
        </configuration> 
        <goals> 
         <goal>run</goal> 
        </goals> 
       </execution> 

       <execution> <!--mvn antrun:[email protected]> 
        <id>hbm2dao</id> 
        <phase>none</phase> 
        <configuration> 
         <target> 
          <echo message="Start generating dao .."/> 
          <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"/> 
          <hibernatetool> 
           <jdbcconfiguration 
             revengfile="src/main/resources/hibernate.reveng.xml" 
             packagename="it.webgate.dao" 

             detectmanytomany="true" 
             configurationfile="src/main/resources/hibernate.cfg.xml"/> 
           <hbmtemplate destdir="${basedir}/src/main/java" 
              templatepath="${basedir}/src/main/resources/template" 
              template="daohome.ftl" 



              filepattern="{package-name}/{class-name}Dao.java"> 
            <property key="ejb3" value="true" /> 
            <property key="jdk5" value="true" /> 

           </hbmtemplate> 
          </hibernatetool> 
          <echo message="End generating dao"/> 
         </target> 
        </configuration> 
        <goals> 
         <goal>run</goal> 
        </goals> 
       </execution> 
      </executions> 
      <dependencies> 
       <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core --> 
       <dependency> 
        <groupId>org.hibernate</groupId> 
        <artifactId>hibernate-core</artifactId> 
        <version>4.3.11.Final</version> 
       </dependency> 

       <dependency> 
        <groupId>org.hibernate</groupId> 
        <artifactId>hibernate-core</artifactId> 
        <version>4.3.11.Final</version> 
       </dependency> 
       <dependency> 
        <groupId>org.hibernate</groupId> 
        <artifactId>hibernate-entitymanager</artifactId> 
        <version>4.3.11.Final</version> 
       </dependency> 
       <!-- https://mvnrepository.com/artifact/org.hibernate.common/hibernate-commons-annotations --> 
       <dependency> 
        <groupId>org.hibernate.common</groupId> 
        <artifactId>hibernate-commons-annotations</artifactId> 
        <version>4.0.5.Final</version> 
       </dependency> 

       <dependency> 
        <groupId>org.hibernate.javax.persistence</groupId> 
        <artifactId>hibernate-jpa-2.1-api</artifactId> 
        <version>1.0.0.Final</version> 
       </dependency> 
       <dependency> 
        <groupId>javax.transaction</groupId> 
        <artifactId>jta</artifactId> 
        <version>1.1</version> 
       </dependency> 
       <dependency> 
        <groupId>freemarker</groupId> 
        <artifactId>freemarker</artifactId> 
        <version>2.3.8</version> 
       </dependency> 
       <dependency> 
        <groupId>org.postgresql</groupId> 
        <artifactId>postgresql</artifactId> 
        <version>9.4.1207.jre7</version> 
       </dependency> 
       <dependency> 
        <groupId>commons-logging</groupId> 
        <artifactId>commons-logging</artifactId> 
        <version>1.1</version> 
       </dependency> 
       <dependency> 
        <groupId>commons-collections</groupId> 
        <artifactId>commons-collections</artifactId> 
        <version>3.2.1</version> 
       </dependency> 
       <dependency> 
        <groupId>org.hibernate</groupId> 
        <artifactId>hibernate-tools</artifactId> 
        <version>4.3.2.Final</version> 
        <exclusions> 
         <exclusion> 
          <groupId>*</groupId> 
          <artifactId>*</artifactId> 
         </exclusion> 
        </exclusions> 
       </dependency> 
      </dependencies> 
     </plugin> 
    </plugins> 
</build> 
関連する問題