我正在尝试遵循这本在线书籍的第7章中的教程:http://books.sonatype.com/mvnex-book/reference/index.html
本教程旨在演示一个带有Spring Framework和hibernate的web应用程序,我被困在这里了:
mvn休眠3:hbm2ddl
...
<build>
<finalName>simple-webapp</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<dependencies>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>annotationconfiguration</implementation>
</component>
</components>
</configuration>
<dependencies>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.7.Final</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>错误消息如下。任何洞察力或指针都将受到赞赏。谢谢。
@localhost simple-webapp]$ mvn hibernate3:hbm2ddl
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.sonatype.mavenbook.multispring:simple-webapp:war:1.0
[WARNING] 'build.plugins.plugin.version' for org.mortbay.jetty:maven-jetty-plugin is missing. @ org.sonatype.mavenbook.multispring:simple-webapp:[unknown-version], /home/abigail/workspace/simple-parent/simple-webapp/pom.xml, line 46, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler- plugin is missing. @ org.sonatype.mavenbook.multispring:simple-parent:1.0, /home/abigail/workspace/simple-parent/pom.xml, line 29, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Simple Web Application 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> hibernate3-maven-plugin:3.0:hbm2ddl (default-cli) > compile @ simple-webapp >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ simple-webapp ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/abigail/workspace/simple-parent/simple- webapp/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ simple-webapp ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< hibernate3-maven-plugin:3.0:hbm2ddl (default-cli) < compile @ simple-webapp <<<
[INFO]
[INFO] --- hibernate3-maven-plugin:3.0:hbm2ddl (default-cli) @ simple-webapp ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.959 s
[INFO] Finished at: 2014-09-03T02:35:24-04:00
[INFO] Final Memory: 12M/208M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:3.0:hbm2ddl (default-cli) on project simple-webapp: There was an error creating the AntRun task. NullPointerException -> [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发布于 2014-09-03 15:15:47
试着为你的maven-jetty-plugin插件添加版本,看看是否能解决这个问题,因为有一个警告说:
[WARNING] 'build.plugins.plugin.version' for org.mortbay.jetty:maven-jetty-plugin is missing. @ org.sonatype.mavenbook.multispring:simple-webapp:[unknown-version], /home/abigail/workspace/simple-parent/simple-webapp/pom.xml, line 46, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler- plugin is missing. @ org.sonatype.mavenbook.multispring:simple-parent:1.0, /home/abigail/workspace/simple-parent/pom.xml, line 29, column 12例如:
<version>4.2.14</version>
发布于 2014-09-03 17:02:33
你能试试下面的插件吗?
<plugin>
<!-- Run "mvn hibernate3:hbm2ddl" to generate schema -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>${hibernate3.maven.plugin.version}</version>
<configuration>
<hibernatetool>
<annotationconfiguration propertyfile="src/main/resources/${hibernate.properties}" />
<hbm2ddl update="true" create="true" export="false"
outputfilename="${hibernate.hbm2ddl.sqlfile}" format="true"
console="true" />
</hibernatetool>
</configuration>
</plugin>而不是
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>annotationconfiguration</implementation>
</component>
</components>
</configuration>发布于 2019-07-28 01:30:30
我遇到了与您相同的问题(使用Java8),并通过将插件版本从2.0切换到2.2解决了这个问题。如果您尝试较新的版本,它似乎再次崩溃。
想知道是否有更好的方法来解决这样的版本问题,而不是试错结合广泛的搜索引擎使用。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>annotationconfiguration</implementation>
</component>
</components>
</configuration>
<dependencies>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>
</dependency>
</dependencies>
</plugin>https://stackoverflow.com/questions/25637813
复制相似问题