Maven Webstart插件看不到主类

时间:2019-06-06 10:12:22

标签: java maven maven-plugin mainclass maven-webstart-plugin

我想将com.mylibrary.startup.Main用作webstart应用程序中的主要类。

此类属于一个jar,它是作为编译时依赖项添加的:

<dependency>
    <groupId>com.mylibrary</groupId>
    <artifactId>mylibrary-startup</artifactId>
    <version>1.8.3</version>
</dependency>

主类已添加到配置中:

<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>webstart-maven-plugin</artifactId>
      <version>1.0-beta-7</version>
      <executions>
        <execution>
          <id>jnlp-auth</id>
          <phase>site</phase>
          <goals>
            <goal>jnlp</goal>
          </goals>
          <configuration>
            .......
            <jnlp> 
              <mainClass>com.mylibrary.startup.Main</mainClass>
            </jnlp>
          </configuration>
 .......
<build>

使用webstart-maven-plugin有一种奇怪的情况。 似乎找不到该类(请参见示例1)。但是,让我们作一个肮脏的hack并在当前项目中添加一个具有完全相同名称的类,并且会出现有关从依赖项与该类冲突的警告(请参见示例2)。

您能帮助配置内部版本,以便webstart-plugin能够找到主类吗?

  • 示例1(无法找到课程)

    [INFO] --- webstart-maven-plugin:1.0-beta-7:jnlp (jnlp-auth) @ my-app
    [INFO] --------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] --------------------------------------------------------------
    [INFO] Total time: 02:40 min
    [INFO] Finished at: 2019-06-06T14:40:51+05:00
    [INFO] Final Memory: 96M/1448M
    [INFO] --------------------------------------------------------------
    
    [ERROR] Failed to execute goal 
            org.codehaus.mojo:webstart-maven-plugin:1.0-beta-7:jnlp (jnlp-auth) on 
            project ksiemp: didn't find artifact with main class: 
            com.mylibrary.startup.Main. Did you specify it?  -> [Help 1]
    
            org.apache.maven.lifecycle.LifecycleExecutionException:
            Failed to execute goal org.codehaus.mojo:webstart-maven-plugin:1.0-beta-7:jnlp (jnlp-auth) on project ksiemp: didn't find artifact with main class: com.mylibrary.startup.Main. Did you specify it? 
    
  • 示例2(检测到重复的类)

    [INFO] --- webstart-maven-plugin:1.0-beta-7:jnlp-inline (jnlp-noauth) @ my-app---
    [WARNING] artifact com.mylibrary:mylibrary-startup:jar:1.8.3:compile 
              also contains the main class: com.mylibrary.startup.Main. IGNORED.
    

0 个答案:

没有答案