在Netbeans中从Github创建库.jar

时间:2014-07-13 02:47:06

标签: maven netbeans jar java

我正在尝试使用GitHub(MailChimp API Wrapper for Java)上提供的库。不幸的是,它们不会直接下载库类路径.jar或javadocs。

尝试自己构建classpath .jar,我下载了包含Netbeans项目的.zip文件并打开了Netbeans项目(这是一个Maven项目......我对Maven不太熟悉)。我试着清理&构建项目(希望它能吐出一个很好的.jar,我可以将其导入到我的其他项目中)。

enter image description here

但是,干净&使用此消息构建失败:

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test (default-test) on project ecwid-mailchimp: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? -> [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/PluginExecutionException

它引导您的网站说:

  

如果由于某些无法预料的事件而导致插件执行失败,则会报告此错误。例如,插件引起的未捕获的运行时异常将引发此错误。您应该将此问题报告给插件的维护者。

现在,我很想相信我已经完成了所有事情,这确实是构建的问题。但是,在我向API创建者发送一封讨厌的电子邮件之前,我想确保错误不在我的最后。

因此,问题是:如果你想编译一个Netbeans Maven项目来创建一个库类路径.jar以便在另一个项目中使用,你会怎么做?我正确地做到了吗?

编辑:

使用-e构建项目产生了结果:

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test (default-test) on project ecwid-mailchimp: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test (default-test) on project ecwid-mailchimp: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: java.lang.RuntimeException: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
    at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.close(ForkClient.java:245)
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:282)
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:116)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:695)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAllProviders(AbstractSurefireMojo.java:666)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:624)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:587)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    ... 20 more

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/PluginExecutionException

Soo ....这是一件事。

1 个答案:

答案 0 :(得分:1)

如果你只是想要jar并且不想关心测试执行(死亡的地方)你可以调用

mvn clean install -DskipTests

跳过surefire插件的执行并获取jar

然后在你的项目中将此工件添加为依赖项(假设它是maven项目)

<dependency>
    <groupId></groupId>
    <artifactId></artifactId>
    <version></version>
</dependency>

如果你想看看出了什么问题,我怀疑它是最可能与OutOfMemory相关的jvm崩溃,我会通过在MAVEN_OPTS中设置更高的堆空间并增加surefire&#来增加maven的内存39; s插件jvm的堆如果它是一个fork