2016-03-08 81 views
0

我使用javafx-maven插件來創建一個javafx webstart應用程序。使用javafx-maven插件簽署jar文件時遇到了一些問題。我想要做的是,用javafx-maven插件打包(jar)應用程序,然後使用maven-jarsigner-plugin簽署jar文件。 如何在應用程序打包後執行maven-jarsigner-plugin來簽署我的文件?如何在maven的某個階段之後明確執行一個插件?

<plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-jarsigner-plugin</artifactId> 
       <version>1.4</version> 
       <executions> 
        <execution> 

         <goals> 
          <goal>sign</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <archiveDirectory>target/jfx/app/</archiveDirectory> 
        <includes> 
         <include>**/*.jar</include> 
        </includes> 
        <keystore>path tp keystore</keystore> 
        <alias>alias</alias> 
        <storepass>password</storepass> 
        <keypass>password</keypass> 
       </configuration> 
      </plugin> 

      <plugin> 
       <groupId>com.zenjava</groupId> 
       <artifactId>javafx-maven-plugin</artifactId> 
       <version>8.3.0</version> 
       <configuration> 

        <bundler>jnlp</bundler> 
        <mainClass>com.myorg.myapp.launcher.myappLauncher</mainClass> 
        <bundleArguments> 
         <jnlp.allPermisions>true</jnlp.allPermisions> 
         <jnlp.includeDT>true</jnlp.includeDT> 
         <jnlp.outfile>myapp</jnlp.outfile> 
        </bundleArguments> 
       </configuration> 
      </plugin> 

回答

0

要解決此問題,我移動了簽名以驗證階段。

  <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-jarsigner-plugin</artifactId> 
      <version>1.4</version> 
      <executions> 
       <execution> 
        <id>signing</id> 
        <goals> 
         <goal>sign</goal> 
         <goal>verify</goal> 
        </goals> 
        <phase>verify</phase> 
        <inherited>true</inherited> 
        <configuration> 
         ... 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 

然後我調用的Maven這樣的: MVN驗證

或做驗證默認目標

或者您可以將JavaFX的Maven插件的「準備包」階段:

<plugin> 
     <groupId>com.zenjava</groupId> 
     <artifactId>javafx-maven-plugin</artifactId> 
     <version>8.1.0</version> 
     <configuration> 
      <bundler>jnlp</bundler> 
      <mainClass>com.myorg.myapp.launcher.myappLauncher</mainClass> 
      <bundleArguments> 
       <jnlp.allPermisions>true</jnlp.allPermisions> 
       <jnlp.includeDT>true</jnlp.includeDT> 
       <jnlp.outfile>myapp</jnlp.outfile> 
      </bundleArguments> 
     </configuration> 
     <executions> 
      <execution> 
       <id>create-jfxjar</id> 
       <phase>prepare-package</phase> 
       <goals> 
        <goal>build-jar</goal> 
       </goals> 
      </execution> 
     </executions> 
    </plugin> 
相關問題