ant maven插件失败 - 运行@hbm2java

时间:2016-11-27 22:43:46

标签: maven ant

当我运行此命令时

mvn antrun:运行@ hbm2java

我收到了这个错误

    mov si, 0
    mov di, 4
check:
    mov al, msg[si]
    mov ah, msg[di]
    cmp al, ah
    jne notpalin
    inc si
    dec di
    cmp si, di
    jb  check

我已经安装了ANT 1.8并在Windows路径中设置了ANT_HOME e put bin文件夹。

我感觉你正在尝试做一些他们不应该做的事情。例如,我看到作为存储库下载版本1.9的ant apache,我不知道为什么。然后忽略我已安装在我的机器上的事实蚂蚁

感谢

修改

我确认所说的话。我重命名了1.9版本的jar,取而代之的是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

1 个答案:

答案 0 :(得分:0)

我发布了正确的pom。

问题出在工具

中使用的依赖版本中
<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: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@hbm2java-->
                    <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>