当向我的Maven-Java-project添加持久性时,我可以成功地构建和编译(Netbeans中的“清理和构建项目”,我假设它确实mvn站点)项目,但是我将无法在之后启动它(Netbeans中的“运行项目”)。
我已经尝试了一段时间而没有成功。例如,我试图删除pom中的组织.codehaus.mojo插件.xml尽管我的成功没有变化。
有人知道这个问题吗?我对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
完整持久性. 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>
完整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>
我最近在NetBeans中遇到了类似的问题,现在找到了解决方法。当我添加EntityClass并让NetBeans自动添加持久化单元等时,问题开始了。
问题似乎是由持久性单元将文件添加到项目META-INF文件夹引起的,该文件夹将使用不同的技术来计算jars签名或类似的东西。
要删除这些文件,请在pom中的exec-maven-plugin之后添加它:
<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>
您还需要添加存档变量,该变量指向您的.jar文件:
<archive>target/projName-1.0-SNAPSHOT.jar</archive>
最后,在nbactions.xml中添加您的跑步任务:
<goal>org.codehaus.mojo:truezip-maven-plugin:1.2:remove</goal>
就在之前:
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
希望有所帮助!
我正在尝试将protobuf依赖项添加到我的maven项目中。我已经使用mvn install安装了protobuf jar文件:install-file-Dpackaging = jar \-DgeneratePom = true \ < br >-DgroupId = com . Google . proto buf \-DartifactId = proto buf-Java \-Dfile
当我将从开源网站(如Apache,Github)下载的导入时,发生了几个错误:(.注意,所有Maven项目都可以在Eclipse下正确编译和测试。 首先,在将maven项目导入到Eclipse之后,项目图标上将出现,但是项目中没有错误。我发现在文件中存在节点。我删除了节点,然后错误就消失了,我想知道为什么,因为maven项目中没有模块。下面的代码是我之前删除的节点。
问题内容: 我收到以下错误: 这是我的persistence.xml文件: 这是我的persistenceLayer.xml: persistence.xml位于src / META-INF中,该文件位于构建路径中,因此应正确找到它。谁有想法? 问题答案: 好吧,我通常将persistence.xml放在资源文件夹/src/main/resouces/META- INF/persistence.x
我正在尝试使用Angular构建一个静态站点。我想要的是将一些全局css/js/image文件添加到 这是我在索引中的代码。html 我的css文件夹与索引处于同一级别。html文件 我添加的每个样式表都会出现这个错误(来自ng serve with chrome) 拒绝应用http://localhost:4200/css/layers.css的样式,因为它的MIME类型(text/html)不
注意,链接的解决方案(例如,致命错误:无法在classpath或bootclasspath中找到包java.lang)不起作用。 源代码 生成代码: export java_home=/library/java/javaVirtualMachines/jdk1.8.0_25.jdk/contents/home/bin/javac-target 1.8-source 1.8-classpath\“.
我一直在尝试将firebase框架添加到我的ios应用程序中。我按照这里的说明操作:https://www.firebase.com/docs/ios-quickstart.html。当我试图编译我的项目,甚至是firebase模板项目时,我会遇到很多链接器错误。(如果有人感兴趣,我可以将它们粘贴在这里,但这是大量的文本)firebase框架需要这些框架,我已经确保将它们全部包括在内。 是不是还有