向Maven Java项目添加持久性时出错(org.codehaus.mojo)?

向Maven Java项目添加持久性时出错(org.codehaus.mojo)?,java,mysql,maven,jpa,persistence,Java,Mysql,Maven,Jpa,Persistence,将持久性添加到我的Maven Java项目中时,我可以成功地构建和编译该项目(在Netbeans中为“Clean and build project”,我想它确实是mvn站点),但之后我将无法启动它(在Netbeans中为“Run project”) 我已经尝试了一段时间,但没有成功。例如,我曾尝试删除pom.xml中的org.codehaus.mojo插件,尽管我的成功没有改变 有人知道这个问题吗?MySQL数据库的设置是否存在任何错误配置?或者pom.xml中是否存在错误?还是在persis

将持久性添加到我的Maven Java项目中时,我可以成功地构建和编译该项目(在Netbeans中为“Clean and build project”,我想它确实是mvn站点),但之后我将无法启动它(在Netbeans中为“Run project”)

我已经尝试了一段时间,但没有成功。例如,我曾尝试删除pom.xml中的org.codehaus.mojo插件,尽管我的成功没有改变

有人知道这个问题吗?MySQL数据库的设置是否存在任何错误配置?或者pom.xml中是否存在错误?还是在persistence.xml中

NetBeans IDE中的错误:

cd /home/myuser/NetBeansProjects/mavenglasses; JAVA_HOME=/home/myuser/jdk1.7.0_51 /home/myuser/netbeans-7.4/java/maven/bin/mvn "-Dexec.args=-jar ${basedir}/target/mavenglasses-1.0.jar" -Dexec.executable=/home/myuser/jdk1.7.0_51/bin/java org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts.
Scanning for projects...

------------------------------------------------------------------------
Building mavenglasses 1.0
------------------------------------------------------------------------

--- exec-maven-plugin:1.2.1:exec (default-cli) @ mavenglasses ---
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
    at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:240)
    at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:193)
    at java.util.jar.JarVerifier.processEntry(JarVerifier.java:264)
    at java.util.jar.JarVerifier.update(JarVerifier.java:218)
    at java.util.jar.JarFile.initializeVerifier(JarFile.java:345)
    at java.util.jar.JarFile.getInputStream(JarFile.java:412)
    at sun.misc.JarIndex.getJarIndex(JarIndex.java:137)
    at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:674)
    at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:666)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:665)
    at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:638)
    at sun.misc.URLClassPath$3.run(URLClassPath.java:366)
    at sun.misc.URLClassPath$3.run(URLClassPath.java:356)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.misc.URLClassPath.getLoader(URLClassPath.java:355)
    at sun.misc.URLClassPath.getLoader(URLClassPath.java:332)
    at sun.misc.URLClassPath.getResource(URLClassPath.java:198)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:358)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 0.850s
Finished at: Sun Feb 23 02:29:03 CET 2014
Final Memory: 6M/105M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project mavenglasses: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
cd/home/myuser/NetBeansProjects/mavenglasses;JAVA_HOME=/HOME/myuser/jdk1.7.0_51/HOME/myuser/netbeans-7.4/JAVA/maven/bin/mvn“-Dexec.args=-jar${basedir}/target/mavenglasses-1.0.jar”-Dexec.executable=/HOME/myuser/jdk1.7.0_51/bin/JAVA org.codehaus.mojo:exec-maven插件:1.2.1:exec
在保存执行时运行NetBeans编译。跳过阶段执行,将使用依赖项项目的输出目录(打开保存时编译)而不是jar工件。
正在扫描项目。。。
------------------------------------------------------------------------
构建mavenglasses 1.0
------------------------------------------------------------------------
---execmaven插件:1.2.1:exec(默认cli)@mavenglasses---
线程“main”java.lang.SecurityException中出现异常:清单主属性的签名文件摘要无效
位于sun.security.util.SignatureFileLeverifier.processImpl(SignatureFileLeverifier.java:240)
在sun.security.util.SignatureFileForever.process(SignatureFileForever.java:193)中
位于java.util.jar.JarVerifier.processEntry(JarVerifier.java:264)
位于java.util.jar.JarVerifier.update(JarVerifier.java:218)
位于java.util.jar.JarFile.initializeVerifier(JarFile.java:345)
位于java.util.jar.JarFile.getInputStream(JarFile.java:412)
位于sun.misc.JarIndex.getJarIndex(JarIndex.java:137)
位于sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:674)
位于sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:666)
位于java.security.AccessController.doPrivileged(本机方法)
在sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:665)
位于sun.misc.URLClassPath$JarLoader。(URLClassPath.java:638)
位于sun.misc.URLClassPath$3.run(URLClassPath.java:366)
位于sun.misc.URLClassPath$3.run(URLClassPath.java:356)
位于java.security.AccessController.doPrivileged(本机方法)
位于sun.misc.URLClassPath.getLoader(URLClassPath.java:355)
位于sun.misc.URLClassPath.getLoader(URLClassPath.java:332)
位于sun.misc.URLClassPath.getResource(URLClassPath.java:198)
在java.net.URLClassLoader$1.run(URLClassLoader.java:358)
在java.net.URLClassLoader$1.run(URLClassLoader.java:355)
位于java.security.AccessController.doPrivileged(本机方法)
位于java.net.URLClassLoader.findClass(URLClassLoader.java:354)
位于java.lang.ClassLoader.loadClass(ClassLoader.java:425)
位于sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
位于java.lang.ClassLoader.loadClass(ClassLoader.java:358)
在sun.launcher.LaunchHelper.checkAndLoadMain(LaunchHelper.java:482)中
------------------------------------------------------------------------
构建失败
------------------------------------------------------------------------
总时间:0.850s
完成时间:2014年2月23日星期日02:29:03 CET
最终内存:6M/105M
------------------------------------------------------------------------
无法在project mavenglasses上执行目标org.codehaus.mojo:exec maven插件:1.2.1:exec(默认cli):命令执行失败。进程已退出,但出现错误:1(退出值:1)->[帮助1]
要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
使用-X开关重新运行Maven以启用完全调试日志记录。
有关错误和可能的解决方案的更多信息,请阅读以下文章:
[帮助1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
完整persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  <persistence-unit name="GlassesPU" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>com.treasury.mavenglasses.Hund</class>
    <properties>
      <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/glasses?zeroDateTimeBehavior=convertToNull"/>
      <property name="javax.persistence.jdbc.password" value="mypwd"/>
      <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
      <property name="javax.persistence.jdbc.user" value="root"/>
      <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
    </properties>
  </persistence-unit>
</persistence>

org.eclipse.persistence.jpa.PersistenceProvider
com.treasury.mavenglasses.Hund
完整的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.treasury</groupId>
    <artifactId>mavenglasses</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <name>mavenglasses</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mainClass>com.treasury.mavenglasses.MainApp</mainClass>
    </properties>

    <organization>
        <!-- Used as the 'Vendor' for JNLP generation -->
        <name>Your Organisation</name>
    </organization>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <excludeScope>system</excludeScope>
                            <excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>

                        <phase>package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>${java.home}/../bin/javafxpackager</executable>
                            <arguments>
                                <argument>-createjar</argument>
                                <argument>-nocss2bin</argument>
                                <argument>-appclass</argument>
                                <argument>${mainClass}</argument>
                                <argument>-srcdir</argument>
                                <argument>${project.build.directory}/classes</argument>
                                <argument>-outdir</argument>
                                <argument>${project.build.directory}</argument>
                                <argument>-outfile</argument>
                                <argument>${project.build.finalName}.jar</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>  
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <compilerArguments>
                        <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
                    </compilerArguments>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.5.1</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
            <version>2.5.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.29</version>
        </dependency>
    </dependencies>
</project>

4.0.0
财政部
马文格拉斯
1
罐子
马文格拉斯
UTF-8
com.treasury.mavenglasses.MainApp
您的组织
org.apache.maven.plugins
maven依赖插件
2.6
解包依赖项
包裹
解包依赖项
系统
junit,org.mockito,org.hamcrest
${project.build.directory}/classes
org.codehaus.mojo
execmaven插件
1.2.1
解包依赖项
包裹
执行官
${java.home}/./bin/javafxpacker
-createjar
-nocss2bin
-应用类
${mainClass}
-srcdir
${project.build.directory}/classes
-奥特迪尔
${project.build.directory}
-外锉
<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>truezip-maven-plugin</artifactId>
            <version>1.2</version>
            <executions>
                <execution>
                    <id>remove-RSA-and-SF-files</id>
                    <goals>
                        <goal>remove</goal>
                    </goals>
                    <phase>package</phase>
                    <configuration>
                        <fileset>
                            <directory>${archive}/META-INF</directory>
                            <includes>
                                <include>**/*.RSA</include>
                                <include>**/*.SF</include>
                                <include>**/*.DSA</include>
                            </includes>
                        </fileset>
                    </configuration>
                </execution>
            </executions>
</plugin>
<archive>target/projName-1.0-SNAPSHOT.jar</archive>
<goal>org.codehaus.mojo:truezip-maven-plugin:1.2:remove</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>