生成jar
生成jar的过程会出现以下问题:
clean完了之后就会出现以下问题:
"D:\Program Files\Java\JDK\jdk1.8.0_31\bin\java" "-Dmaven.home=D:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.2\plugins\maven\lib\maven3" "-Dclassworlds.conf=D:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.2\plugins\maven\lib\maven3\bin\m2.conf" -Didea.launcher.port=7535 "-Didea.launcher.bin.path=D:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.2\bin" -Dfile.encoding=GBK -classpath "D:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.2\plugins\maven\lib\maven3\boot\plexus-classworlds-2.4.jar;D:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.2\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=14.1.2 install [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building oxgren-common 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ oxgren-common --- [debug] execute contextualize [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ oxgren-common --- [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent! [INFO] Compiling 5 source files to D:\JavaWorkSpace\oxgren\oxgren-common\target\classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] Unable to locate the Javac Compiler in: D:\Program Files\Java\JDK\jdk1.8.0_31\..\lib\tools.jar Please ensure you are using JDK 1.4 or above and not a JRE (the com.sun.tools.javac.Main class is required). In most cases you can change the location of your Java installation by setting the JAVA_HOME environment variable. [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.114s [INFO] Finished at: Mon Sep 07 20:06:03 CST 2015 [INFO] Final Memory: 7M/164M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project oxgren-common: Compilation failure [ERROR] Unable to locate the Javac Compiler in: [ERROR] D:\Program Files\Java\JDK\jdk1.8.0_31\..\lib\tools.jar [ERROR] Please ensure you are using JDK 1.4 or above and [ERROR] not a JRE (the com.sun.tools.javac.Main class is required). [ERROR] In most cases you can change the location of your Java [ERROR] installation by setting the JAVA_HOME environment variable. [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/MojoFailureException Process finished with exit code 1
在目录上compile module 再去 install 就可以生成jar包了
jre找不到 不关心这么多了 ,正确的如下
"D:\Program Files\Java\JDK\jdk1.8.0_31\bin\java" "-Dmaven.home=D:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.2\plugins\maven\lib\maven3" "-Dclassworlds.conf=D:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.2\plugins\maven\lib\maven3\bin\m2.conf" -Didea.launcher.port=7537 "-Didea.launcher.bin.path=D:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.2\bin" -Dfile.encoding=GBK -classpath "D:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.2\plugins\maven\lib\maven3\boot\plexus-classworlds-2.4.jar;D:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.2\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=14.1.2 install [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building oxgren-common 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ oxgren-common --- [debug] execute contextualize [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ oxgren-common --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ oxgren-common --- [debug] execute contextualize [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\JavaWorkSpace\oxgren\oxgren-common\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ oxgren-common --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ oxgren-common --- [INFO] Surefire report directory: D:\JavaWorkSpace\oxgren\oxgren-common\target\surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running Base64HanderTest encodeStr:6L+b5YWlamF2YeeahOS4lueVjA== urlEncodeStr:6L-b5YWlamF2YeeahOS4lueVjA== mimeEncodeStr:6L+b5YWlamF2YeeahOS4lueVjA== Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.094 sec Running WithAttachmentMessageTest 发送邮件 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.125 sec Results : Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ oxgren-common --- [INFO] Building jar: D:\JavaWorkSpace\oxgren\oxgren-common\target\oxgren-common-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.3.1:install (default-install) @ oxgren-common --- [INFO] Installing D:\JavaWorkSpace\oxgren\oxgren-common\target\oxgren-common-1.0-SNAPSHOT.jar to C:\Users\yuchao\.m2\repository\oxgren\oxgren-common\1.0-SNAPSHOT\oxgren-common-1.0-SNAPSHOT.jar [INFO] Installing D:\JavaWorkSpace\oxgren\oxgren-common\pom.xml to C:\Users\yuchao\.m2\repository\oxgren\oxgren-common\1.0-SNAPSHOT\oxgren-common-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.785s [INFO] Finished at: Mon Sep 07 20:23:45 CST 2015 [INFO] Final Memory: 9M/164M [INFO] ------------------------------------------------------------------------ Process finished with exit code 0
如果test存在不通过的内容,也无法完成jar