when i run this command
mvn antrun:run@hbm2java
i got this error
[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
i've installed ANT 1.8 and set ANT_HOME e put bin folder inside windows path.
I get the feeling you're trying to do something they should not. for example, I see that as a repository download version 1.9 of ant apache and I do not know why. then ignore the fact that I have installed on my machine ant
thanks
edit
I confirm what has been said. I renamed the jar of version 1.9 and put in its place that of 1.8. everything works perfectly. But it would be better that everything worked without these tricks
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution> <!--mvn antrun:run@hbm2java-->
<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:run@hbm2dao-->
<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.ciccio.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>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>5.0.1.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>${hibernate.version}</version>
<exclusions>
<exclusion>
<groupId>org.hiernate</groupId>
<artifactId>${hibernate.version}</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>