Domanda

Nella speranza che qualcuno mi può aiutare con questo strano. Sto cercando di eseguire il plugin webstart ma non sembrano essere in grado di trovare la classe principale all'interno del barattolo di essere prodotti. Il pom è così semplice come si può ottenere, ed esiste la prova di classe, ed è in fase di compilazione e collocato nel vaso. Qualcuno può per favore mi punto nella giusta direzione?

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

Ecco la traccia Maven:

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

La traccia segue

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)

Ora la Causato da traccia

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

E la traccia Maven finale

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

Nessuna soluzione corretta

Altri suggerimenti

Questo è un problema con mainClass per JNLP

Hai bisogno di qualcosa di simile

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

Sono sicuro che questo non è più un problema per voi, come la questione è di un anno. Tuttavia, per ragioni di completezza ...

Ho modificato la domanda a renderlo leggibile. Questo ci mostra l'errore è sulla linea 214 di AbstractJnlpMojo. Guardando al più tardi codice sorgente versione on line 214 (la causa principale di cui sopra), possiamo vedere che questo è perché non è stato specificato il metodo principale per la JNLP file.

Il JNLP non ha bisogno la classe principale metodo appena specificato nelle risorse vaso. Ha bisogno anche nel tag JNLP, come questo.

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

Per quanto il codice è cambiato, se avete fatto questo oggi, si otterrebbe la seguente eccezione (un po 'più leggibile):

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

Per risolvere questo problema:

  

non ha trovato artefatto con classe principale: null. È stato specificato che?

ho dovuto creare un progetto Maven multi-modulo come segue:

  • base-progetto
    • principale-app
    • webstart

Poi all'interno del file pom di webstart ho inserito main-app come una dipendenza. Infine, eseguire mvn webstart:jnlp dall'interno directory webstart.

Non credo che le sue le dipendenze che non si trovano, ma piuttosto alcuni file in C:? \ TEMP \ webstart-test \ src \ Main \ JNLP \ risorse, come ad esempio il modello Velocity per il file JNLP forse

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top