Maven 2 Maven webstart插件找不到依赖项

Maven 2 Maven webstart插件找不到依赖项,maven-2,java-web-start,maven-webstart-plugin,Maven 2,Java Web Start,Maven Webstart Plugin,希望有人能帮我解决这个奇怪的问题。我正在尝试运行webstart插件,但它似乎无法在正在生成的jar中找到主类。pom尽可能简单,类测试存在,并且正在编译并放置在jar中。有人能给我指一下正确的方向吗 <project> <modelVersion>4.0.0</modelVersion> <name>Desktop Components</name> <groupId>com.test</groupId&

希望有人能帮我解决这个奇怪的问题。我正在尝试运行webstart插件,但它似乎无法在正在生成的jar中找到主类。pom尽可能简单,类测试存在,并且正在编译并放置在jar中。有人能给我指一下正确的方向吗

<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>
线索如下

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] ------------------------------------------------------------------------

我不认为找不到的是您的依赖项,而是C:\TEMP\webstart test\src\main\jnlp\resources中的一些文件,例如jnlp文件的Velocity模板?

这是jnlp的mainClass的问题

你需要这样的东西

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

测试

我相信这对你来说不再是问题,因为这个问题已经有一年了。然而,为了完整起见

我对问题进行了编辑,使其可读。这向我们展示了AbstractJnlpMojo第214行的错误。在第214行(上面的根本原因),我们可以看到这是因为您没有为JNLP文件指定main方法

JNLP不需要只是在jar资源中指定的主方法类。它还需要在JNLP标记中使用它,如下所示

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

为了解决这个问题:

未找到主类为null的工件。你指定了吗

我必须创建一个多模块maven项目,如下所示:

  • 基础项目
    • 主应用程序
    • 网站启动

然后在
webstart
的pom文件中,我将
main app
作为依赖项包含进来。最后,从
webstart
目录中运行
mvnwebstart:jnlp

请花些时间格式化您当前无法阅读的问题,并解释您试图实现的目标。webstart插件有很多目标,所以“我正在尝试运行webstart plugin”并不清楚,即使我可以看到您正在调用哪个目标。问题是你在混淆概念,所以我不知道你想做什么。正如我所说的,花点时间来澄清并以明智的方式提问()。@napoleon:使用默认的Velocity模板。
    <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?