在IntelliJ Idea 15.04上使用maven构建jcarsdsim

时间:2016-03-06 07:30:51

标签: java maven intellij-idea pom.xml simulator

所以假设我从源代码中建立that存储库。 Here是开发人员给出的说明。

А用内置的ItlliJ VCS工具克隆它后我修改了默认pom.xml以使maven工作。

因此,在maven控制台中执行mvn initialize后,我得到了以下日志:

"C:\Program Files\Java\jdk1.8.0_73\bin\java" "-Dmaven.home=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.4\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.4\plugins\maven\lib\maven3\bin\m2.conf" -Didea.launcher.port=7537 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.4\plugins\maven\lib\maven3\boot\plexus-classworlds-2.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=15.0.4 initialize
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Java Card Runime Environment Simulator 3.0.4
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install-file (default) @ jcardsim ---
[INFO] pom.xml not found in api.jar
[INFO] Installing C:\java_card_kit-2_2_2\lib\api.jar to C:\Users\Foo\.m2\repository\oracle\javacard\api_classic\2.2.2\api_classic-2.2.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.527s
[INFO] Finished at: Sun Mar 06 10:19:39 MSK 2016
[INFO] Final Memory: 5M/116M
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

这是好的,我想。

但是当执行mvn clean install以生成.jar文件时,我遇到以下错误:

"C:\Program Files\Java\jdk1.8.0_73\bin\java" "-Dmaven.home=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.4\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.4\plugins\maven\lib\maven3\bin\m2.conf" -Didea.launcher.port=7538 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.4\plugins\maven\lib\maven3\boot\plexus-classworlds-2.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=15.0.4 clean install
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Java Card Runime Environment Simulator 3.0.4
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ jcardsim ---
[INFO] Deleting C:\Users\Foo\Documents\GitHub\jcardsim\target
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install-file (default) @ jcardsim ---
[INFO] pom.xml not found in api.jar
[INFO] Installing C:\java_card_kit-2_2_2\lib\api.jar to C:\Users\Foo\.m2\repository\oracle\javacard\api_classic\2.2.2\api_classic-2.2.2.jar
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ jcardsim ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Foo\Documents\GitHub\jcardsim\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ jcardsim ---
[INFO] Compiling 86 source files to C:\Users\Foo\Documents\GitHub\jcardsim\target\classes
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:unpack (default) @ jcardsim ---
[INFO] Configured Artifact: oracle.javacard:api_classic:2.2.2:jar
[INFO] Unpacking C:\Users\Foo\.m2\repository\oracle\javacard\api_classic\2.2.2\api_classic-2.2.2.jar to C:\Users\Foo\Documents\GitHub\jcardsim\target\classes with includes "**/*.class" and excludes ""
[INFO] 
[INFO] --- exec-maven-plugin:1.4.0:java (default) @ jcardsim ---
[WARNING] 
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: ClassReader.accept() should be called with EXPAND_FRAMES flag
    at org.objectweb.asm.commons.LocalVariablesSorter.visitFrame(Unknown Source)
    at org.objectweb.asm.commons.RemappingMethodAdapter.visitFrame(Unknown Source)
    at org.objectweb.asm.tree.FrameNode.accept(Unknown Source)
    at org.objectweb.asm.tree.InsnList.accept(Unknown Source)
    at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
    at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
    at org.objectweb.asm.tree.ClassNode.accept(Unknown Source)
    at com.licel.jcardsim.utils.JavaCardApiProcessor.proxyClass(JavaCardApiProcessor.java:92)
    at com.licel.jcardsim.utils.JavaCardApiProcessor.main(JavaCardApiProcessor.java:47)
    ... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.245s
[INFO] Finished at: Sun Mar 06 10:21:25 MSK 2016
[INFO] Final Memory: 20M/201M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default) on project jcardsim: An exception occured while executing the Java class. null: InvocationTargetException: ClassReader.accept() should be called with EXPAND_FRAMES flag -> [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

Process finished with exit code 1

由于我是Java世界的新手,尤其是Maven,我想知道问题是什么以及如何正确修复它?

我正在使用IntelliJ Idea 15.04Java 1.8JCSDK 2.2.2

运行Windows 8.1

更新

Here是原始版本与pom.xml

之间的差异

Heremvn -X clean install

的输出

1 个答案:

答案 0 :(得分:1)

如果您从

还原更改
<java.version>1.8</java.version>

回到

<java.version>1.5</java.version>

它会起作用。

如果要生成Java 8字节码,则需要以适当的方式修改类JavaCardApiProcessor.java