我使用oracle中的javaee7 sdk。我遇到了一个问题。当我输入mvn cargo:run
时,它会在Resolved container artifact org.codehaus.cargo:cargo-core-container-glassfish:jar:1.4.0 for container glassfish4x
停留很长时间。最后,发生了一些错误:Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run
。
以下是我的详细步骤:
cmd
进入控制台并cd C:\glassfish4
。mvn clean
。mvn verify
。mvn package
mvn cargo:run
最后,控制台告诉我Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run
,这里是详细错误
[DEBUG] [en2.ContainerRunMojo] Resolved artifact and dependencies: [file:/C:/zjf/soft/apache-maven-3.3.9/repo/org/codehaus/cargo/cargo-core-container-glassfish/1.4.0/cargo-core-container-glassfish-1.4.0.jar]
[INFO] [en2.ContainerRunMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-glassfish:jar:1.4.0 for container glassfish4x
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Java EE 7 Samples Main Parent Project .............. FAILURE [14:17 min]
[INFO] Java EE 7 JSF Samples .............................. SKIPPED
[INFO] Annotated Enter Flow Sample ........................ SKIPPED
[INFO] Composite Component Sample ......................... SKIPPED
[INFO] Resource Library Contracts JSF Sample .............. SKIPPED
[INFO] Custom Converter Sample ............................ SKIPPED
[INFO] Custom Namespace Composite Component Sample ........ SKIPPED
[INFO] Custom Validator Sample ............................ SKIPPED
[INFO] DateTimeConverter Sample ........................... SKIPPED
[INFO] Enter and Exit Flow Sample ......................... SKIPPED
[INFO] JSF Stock Sample ................................... SKIPPED
[INFO] Faces Flow JSF Sample .............................. SKIPPED
[INFO] Filesystem Resource Library Contract ............... SKIPPED
[INFO] File Upload JSF Sample ............................. SKIPPED
[INFO] HTML5 JSF Sample ................................... SKIPPED
[INFO] Index Flow Sample .................................. SKIPPED
[INFO] Nested Composite Component Sample .................. SKIPPED
[INFO] Override Renderer Sample ........................... SKIPPED
[INFO] Packaged Composite Component Sample ................ SKIPPED
[INFO] Packaged Custom Converter Sample ................... SKIPPED
[INFO] HTML5 Passthrough Sample ........................... SKIPPED
[INFO] Scrumtoys POM ...................................... SKIPPED
[INFO] Scrumtoys Entities ................................. SKIPPED
[INFO] Scrumtoys Flows POM ................................ SKIPPED
[INFO] Scrumtoys ManageStoryAttachments ................... SKIPPED
[INFO] Scrumtoys Resource Library Contracts POM ........... SKIPPED
[INFO] Scrumtoys Red Skin ................................. SKIPPED
[INFO] Scrumtoys Yellow Skin .............................. SKIPPED
[INFO] Scrumtoys Orange Skin .............................. SKIPPED
[INFO] Scrumtoys JSF Sample ............................... SKIPPED
[INFO] Stateless View Sample .............................. SKIPPED
[INFO] Style and Layout Resource Library Contract Sample .. SKIPPED
[INFO] Use JAR-Packaged Composite Component Sample ........ SKIPPED
[INFO] Use JAR-Packaged Custom Converter Sample ........... SKIPPED
[INFO] View-based Resource Library Contract Sample ........ SKIPPED
[INFO] Java EE 7 REST Samples ............................. SKIPPED
[INFO] Message Board REST Sample Application .............. SKIPPED
[INFO] Asynchronous chat REST Sample Application .......... SKIPPED
[INFO] Java EE 7 Servlet Samples .......................... SKIPPED
[INFO] annotation-war ..................................... SKIPPED
[INFO] async-request-war .................................. SKIPPED
[INFO] dynamic-registration-war ........................... SKIPPED
[INFO] multipart-war ...................................... SKIPPED
[INFO] session-cookie-config-war .......................... SKIPPED
[INFO] jsp-resource-in-bundled-jar-war .................... SKIPPED
[INFO] servlet-container-initializer ...................... SKIPPED
[INFO] servlet-container-initializer-war .................. SKIPPED
[INFO] servlet-container-initializer-lib .................. SKIPPED
[INFO] absolute-ordering-web-fragments .................... SKIPPED
[INFO] fragment1 .......................................... SKIPPED
[INFO] fragment2 .......................................... SKIPPED
[INFO] fragment3 .......................................... SKIPPED
[INFO] absolute-ordering-web-fragments-war ................ SKIPPED
[INFO] non-blocking-io-read-war ........................... SKIPPED
[INFO] non-blocking-io-write-war .......................... SKIPPED
[INFO] http-upgrade-war ................................... SKIPPED
[INFO] Java EE 7 WebSocket Samples ........................ SKIPPED
[INFO] WebSocket Auction Sample Application ............... SKIPPED
[INFO] WebSocket Draw Sample Application .................. SKIPPED
[INFO] WebSocket Echo Sample Application .................. SKIPPED
[INFO] Java EE 7 CDI Samples .............................. SKIPPED
[INFO] Events CDI Sample Application ...................... SKIPPED
[INFO] Interceptors CDI Sample Application ................ SKIPPED
[INFO] Guess CDI Sample Application ....................... SKIPPED
[INFO] Servlet CDI Sample Application ..................... SKIPPED
[INFO] CDI Sample Application for TransactionScoped annotation SKIPPED
[INFO] CDI Sample Application for Transactional annotation SKIPPED
[INFO] CDI Sample Application for Bean Validation ......... SKIPPED
[INFO] Java EE 7 JSON-P Samples ........................... SKIPPED
[INFO] JSON-P JAX-RS Resources Sample Application ......... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14:33 min
[INFO] Finished at: 2016-12-07T23:19:37+08:00
[INFO] Final Memory: 15M/174M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run (default-cli) on project glassfish-samples-parent: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run
failed: Error while expanding C:\Users\zjf\AppData\Local\Temp\cargo\installs\glassfish-4.0.zip
[ERROR] java.io.IOException: Negative seek offset
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run (default-cli) on project glassfish-samples-parent: Execution default-cli of goal o
rg.codehaus.cargo:cargo-maven2-plugin:1.4.0:run failed: Error while expanding C:\Users\zjf\AppData\Local\Temp\cargo\installs\glassfish-4.0.zip
java.io.IOException: Negative seek offset
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run failed: Error while expanding C:\Users\zjf\AppData\Local\Temp\cargo\in
stalls\glassfish-4.0.zip
java.io.IOException: Negative seek offset
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: Error while expanding C:\Users\zjf\AppData\Local\Temp\cargo\installs\glassfish-4.0.zip
java.io.IOException: Negative seek offset
at org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:148)
at org.apache.tools.ant.taskdefs.Expand.execute(Expand.java:107)
at org.codehaus.cargo.container.installer.ZipURLInstaller.unpack(ZipURLInstaller.java:355)
at org.codehaus.cargo.container.installer.ZipURLInstaller.install(ZipURLInstaller.java:236)
at org.codehaus.cargo.maven2.configuration.Container.setupHome(Container.java:793)
at org.codehaus.cargo.maven2.configuration.Container.createContainer(Container.java:460)
at org.codehaus.cargo.maven2.AbstractCargoMojo.createNewContainer(AbstractCargoMojo.java:719)
at org.codehaus.cargo.maven2.ContainerRunMojo.createNewContainer(ContainerRunMojo.java:150)
at org.codehaus.cargo.maven2.AbstractCargoMojo.createContainer(AbstractCargoMojo.java:630)
at org.codehaus.cargo.maven2.ContainerStartMojo.doExecute(ContainerStartMojo.java:54)
at org.codehaus.cargo.maven2.ContainerRunMojo.doExecute(ContainerRunMojo.java:86)
at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo.java:432)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more
Caused by: java.io.IOException: Negative seek offset
at java.io.RandomAccessFile.seek(RandomAccessFile.java:555)
at org.apache.tools.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:403)
at org.apache.tools.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:271)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:152)
at org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:137)
... 33 more
[ERROR]
[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/PluginExecutionException
我知道很难描述我的问题。所以我希望你能像我所做的那样做同样的步骤,然后你会看到同样的问题。我希望有人能解决它。
答案 0 :(得分:0)
好的,我知道这个问题。我应该使用mvn install
代替mvn package
。此外,在使用mvn install
之后,我应该将目录更改为samples / servlet / annotation,然后运行mvn cargo:run
。最后会得到正确的结果。