2016-12-06 7 views
0

私の先生はjavaee7 sdkサンプル "annotation-war"を実行したいと思っています。それから私はhttp://www.oracle.com/technetwork/java/javaee/downloads/index.htmlからjavaee7 sdkをダウンロードします。しかし、私はそれを実行する方法がわかりません。javaee7 sdkサンプルを実行するには?

私は、次の手順を試してみました:

まず、私はIntelijのIDEAにコードをインポートし、mvn cargo:runを実行しますが、some error happen

"C:\Program Files\Java\jdk1.8.0_101\bin\java" -Dmaven.multiModuleProjectDirectory=C:\zjf\code\IDEA\javaee_samples\servlet\annotation-war -Dmaven.home=C:\zjf\soft\apache-maven-3.3.9 -Dclassworlds.conf=C:\zjf\soft\apache-maven-3.3.9\bin\m2.conf -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\zjf\soft\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=2016.3 -s C:\zjf\soft\apache-maven-3.3.9\conf\settings.xml -Dmaven.repo.local=C:\zjf\soft\apache-maven-3.3.9\repo org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building annotation-war 4.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- cargo-maven2-plugin:1.4.0:run (default-cli) @ annotation-war --- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 2.422 s 
[INFO] Finished at: 2016-12-06T19:12:34+08:00 
[INFO] Final Memory: 8M/184M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run (default-cli) on project annotation-war: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run failed: Cannot create configuration. There's no registered configuration for the parameters (container [id = [glassfish4x], type = [installed]], configuration type [standalone]). Actually there are no valid types registered for this configuration. Maybe you've made a mistake spelling it? -> [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/PluginExecutionException 

Process finished with exit code 1 

その後、私はそう、私は間違ったことを行っているかもしれないと思います私は "annotation-war"でdocsを読んでいます。 mvn cleanmvn verifyを実行しても問題ありません。しかし、私はmvn cargo:run -Dglassfish.home=C:\zjf\soft\glassfishを実行したとき、私はまだ同じ問題が発生します

C:\zjf\code\IDEA\javaee_samples\servlet\annotation-war>mvn cargo:run -Dglassfish.home=C:\zjf\soft\glassfish 
[INFO] Scanning for projects... 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building annotation-war 4.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- cargo-maven2-plugin:1.4.0:run (default-cli) @ annotation-war --- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 3.038 s 
[INFO] Finished at: 2016-12-06T20:59:57+08:00 
[INFO] Final Memory: 8M/184M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run (default-cli) on project annotation-war: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run failed: Cannot create configuration. There's no registered configuration for the parameters (container [id = [glassfish4x], type = [installed]], configuration type [standalone]). Actually there are no valid types registered for this configuration. Maybe you've made a mistake spelling it? -> [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/PluginExecutionException 

を私は実際のJavaEE SDKのサンプルを実行する方法がわかりません。それを実行する方法を知っている誰も私にいくつかの助けを与えることができますか?

答えて

0

実行する最も簡単な方法は、最初にmvn installでプロジェクトをビルドし、WARファイルを出力することです。ログの一番下には、WARファイルへの完全な絶対パスが表示されます。 install MavenゴールはMavenで管理されているローカルリポジトリにもコピーします。そのため、同じWARファイルへの2つの異なるパスが表示されます。これらの作品、例えばのどちらか:

/path/to/my/app/target/annotation-war-1.0.0-SNAPSHOT.war 

あなたは、最初のGlassFishが実行されている確認して、WARファイルをデプロイするためのGlassFishでasadminツールを使用することができます。

C:\zjf\soft\glassfish\glassfish4\bin\asadmin start-domain 
C:\zjf\soft\glassfish\glassfish4\bin\asadmin deploy /path/to/my/app/target/annotation-war-1.0.0-SNAPSHOT.war 

これが唯一の方法ではありませんそれを実行するには(多くがありますが)、これは、それが少し長めにされているにもかかわらず、間違って行く可能性が最も少ないもので、undestandするのが最も簡単であることがわかります。

+0

ありがとうございました。私は次のステップを読むべきです。 – hellozjf

+0

はい、私はあなたが最終的に慣れてくると思っています。そして、余分な指示がより明確になり、より役立つはずです。 – Mike

関連する問題