문제

누군가 가이 이상한 사람으로 나를 도울 수 있기를 바라고 있습니다. WebStart 플러그인을 실행하려고하지만 생산중인 JAR 내에서 메인 클래스를 찾을 수없는 것 같습니다. POM은 얻을 수있는만큼 간단하며 수업 테스트가 존재하며 항아리에 컴파일되어 배치됩니다. 누군가 나를 올바른 방향으로 가리킬 수 있습니까?

<project>
  <modelVersion>4.0.0</modelVersion>
  <name>Desktop Components</name>
  <groupId>com.test</groupId>
  <artifactId>test</artifactId>
  <version>1.0</version>
  <packaging>jar</packaging>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo.webstart</groupId>
        <artifactId>webstart-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>process-resources</phase>
            <goals>
              <goal>jnlp-download-servlet</goal>
            </goals>
          </execution>
        </executions>

        <configuration>
          <jnlpFiles>
            <jnlpFile>
              <jarResources>
                <jarResource>
                  <groupId>com.test</groupId>
                  <artifactId>test</artifactId>
                  <version>1.0</version>
                  <mainClass>Test</mainClass>
                </jarResource>
              </jarResources>
            </jnlpFile>
          </jnlpFiles>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

다음은 Maven Trace입니다.

C:\TEMP\webstart-test>mvn webstart:jnlp –e
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Desktop Components
[INFO]    task-segment: [webstart:jnlp] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing webstart:jnlp
[INFO] ------------------------------------------------------------------------
[INFO] Building Desktop Components
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\TEMP\webstart-test\src\main\resources
[INFO] [webstart:jnlp-download-servlet {execution: default}]
[INFO] No templateFilename found for launch2.jnlp. Will use the default template.
[INFO] No resources found in C:\TEMP\webstart-test\src\main\jnlp\resources
Downloading: http://repo1.maven.org/maven2/com/test/test/1.0/test-1.0.pom
[INFO] Unable to find resource 'com.test:test:pom:1.0' in repository central (http://repo1.maven.org/maven2)
No template specified Using default one.

***** Webstart JAR URL: jar:file:/C:/apache-maven-2.2.1/repo/org/codehaus/mojo/webstart/webstart-maven-plugin/1.0-alpha-2/webstart-maven-plugin-1.0-alpha-2.jar!
/
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\TEMP\webstart-test\src\test\resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] No sources to compile
[INFO] [surefire:test {execution: default-test}]
[INFO] No tests to run.
[INFO] [jar:jar {execution: default-jar}]
[INFO] Building jar: C:\TEMP\webstart-test\target\test-1.0.jar
[INFO] [webstart:jnlp {execution: default-cli}]
[INFO] No resources found in C:\TEMP\webstart-test\src\main\jnlp\resources
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failure to run the plugin:
[INFO] ------------------------------------------------------------------------
[INFO] Trace

흔적이 뒤 따릅니다

org.apache.maven.lifecycle.LifecycleExecutionException: Failure to run the plugin:
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

이제 흔적으로 인한 것입니다

Caused by: org.apache.maven.plugin.MojoExecutionException: Failure to run the plugin:
        at org.codehaus.mojo.webstart.AbstractJnlpMojo.execute(AbstractJnlpMojo.java:289)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more

Caused by: java.lang.NullPointerException
        at org.codehaus.mojo.webstart.AbstractJnlpMojo.execute(AbstractJnlpMojo.java:214)
        ... 19 more

그리고 마지막 Maven 추적

[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Fri Nov 13 11:16:54 GMT 2009
[INFO] Final Memory: 12M/22M
[INFO] ------------------------------------------------------------------------

올바른 솔루션이 없습니다

다른 팁

이것은 문제입니다 메인 클래스 JNLP의 경우

당신은 이와 같은 것이 필요합니다

<configuration>
   <jnlp>
      <mainClass>com.test.Test</mainClass>
   </jnlp>
<configuration>

나는 질문이 1 년이 되었기 때문에 이것이 더 이상 당신에게 문제가되지 않는다고 확신합니다. 그러나 완전성을 위해 ...

읽을 수 있도록 질문을 편집했습니다. 이것은 오류가 AbstractJnlpMojo의 214 행에 있음을 보여줍니다. 최신 버전 소스 코드를보고 있습니다 214 행 (위의 근본 원인)에서, 우리는 이것이 JNLP 파일의 기본 메소드를 지정하지 않았기 때문입니다.

JNLP는 JAR 리소스에 지정된 기본 메소드 클래스가 필요하지 않습니다. 또한 JNLP 태그에도 필요합니다.

    <configuration>
      <jnlp>
        <mainClass>com.test.Test</mainClass>
      </jnlp>
    </configuration>

코드가 변경됨에 따라 오늘이 작업을 수행하면 다음과 같은 예외를 얻을 수 있습니다 (좀 더 읽기 쉬운).

org.apache.maven.plugin.MojoExecutionException: 
  didn't find artifact with main class: null. Did you specify it? 

이 문제를 해결하기 위해 :

Main Class : NULL과 함께 인공물을 찾지 못했습니다. 지정 했습니까?

다음과 같이 멀티 모듈 Maven 프로젝트를 만들어야했습니다.

  • 기본 프로젝트
    • 메인 앱
    • 웹 스타트

그런 다음 내부 webstart내가 포함 된 POM 파일 main-app 의존성으로. 마지막으로, 실행하십시오 mvn webstart:jnlp 안으로부터 webstart 예배 규칙서.

나는 당신의 종속성을 찾을 수 없다고 생각하지만, c : temp webstart-test src src main jnlp resources, 예 : JNLP 파일의 속도 템플릿과 같은 일부 파일은?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top