2017-08-12 4 views
0

このハウツーでは、https://www.eclipse.org/swt/eclipse.phpには、EclipseでSWTベースのGUIを構築するための良いガイドがあります。 これでMavenと同じプロジェクトを作成したいと思います。終わりのpom.xmlを使用することにより、私は次のエラーを取得する:Mavenを使用してスタンドアロンのSWT GUIを構築するには?

[DEBUG] adding entry libswt-awt-cocoa-4626.jnilib 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 3.747 s 
[INFO] Finished at: 2017-08-12T15:06:45+02:00 
[INFO] Final Memory: 15M/225M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default-cli) on project swtsandbox: Failed to create assembly: Error creating assembly archive jar-with-dependencies: Problem creating jar: invalid LOC header (bad signature) -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default-cli) on project swtsandbox: Failed to create assembly: Error creating assembly archive jar-with-dependencies: Problem creating jar: invalid LOC header (bad signature) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 

のpom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>pmu</groupId> 
    <artifactId>swtsandbox</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>swtsandbox</name> 
    <url>http://maven.apache.org</url> 

    <properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <maven.compiler.source>1.8</maven.compiler.source> 
    <maven.compiler.target>1.8</maven.compiler.target> 
    <swt.version>4.6.1</swt.version> 
    </properties> 

<repositories> 
    <repository> 
     <id>maven-eclipse-repo</id> 
     <url>http://maven-eclipse.github.io/maven</url> 
    </repository> 
</repositories> 

    <dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>3.8.1</version> 
     <scope>test</scope> 
    </dependency> 

    <!-- select prefered one, or move the preferred on to the top: --> 

     <dependency> 
      <groupId>org.eclipse.swt</groupId> 
      <artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId> 
      <version>${swt.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.eclipse.swt</groupId> 
      <artifactId>org.eclipse.swt.cocoa.macosx.x86_64</artifactId> 
      <version>${swt.version}</version> 
     </dependency> 
    </dependencies> 



<build> 
    <pluginManagement> 
     <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.6.2</version> 
      <configuration> 
      <!-- put your configurations here --> 
      </configuration> 
     </plugin> 

<plugin> 
    <artifactId>maven-assembly-plugin</artifactId> 
    <configuration> 
    <archive> 
     <manifest> 
     <mainClass>pmu.swtsandbox.App</mainClass> 
     </manifest> 
    </archive> 
    <descriptorRefs> 
     <descriptorRef>jar-with-dependencies</descriptorRef> 
    </descriptorRefs> 
    </configuration> 
    <executions> 
    <execution> 
     <id>make-assembly</id> <!-- this is used for inheritance merges --> 
     <phase>package</phase> <!-- bind to the packaging phase --> 
     <goals> 
     <goal>single</goal> 
     </goals> 
    </execution> 
    </executions> 
</plugin> 

     </plugins> 
    </pluginManagement> 
    </build> 
</project> 

Mavenのバージョン:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00) 
Maven home: /usr/local/apache-maven-3.3.9 
Java version: 1.8.0_101, vendor: Oracle Corporation 
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre 
Default locale: en_US, platform encoding: UTF-8 
OS name: "mac os x", version: "10.11.4", arch: "x86_64", family: "mac" 
p 
+0

は、Mavenのアセンブリ - プラグインのバージョンを定義し、さらにそのMavenのバージョンは、使用しないオプション助言しますか?普通のコンソールから実行していますか?またはEclipseの中から? – khmarbaise

+0

アイデアは、ヘッドレス(つまりコマンドライン)アプリケーションをビルドすることです - 編集のために編集を参照してください – poseid

+0

'mvn -C ... 'を使ってチェックサムを検証するようにしましたか?最初のステップは、 $ HOME/.m2/repository'を実行し、アプリケーションを再構築してください。 – khmarbaise

答えて

1

は、1つまたはそれ以上のように見えますローカルの.m2 Mavenリポジトリ内のjarファイルが破損しています(jar-with-dependencies)。すべての依存ファイルを最初にアンパックして、同じjarファイルにバンドルしようとします。

残念ながら、エラーメッセージには、どの旨が記載されていません。

次のいずれかを実行できます。

  • あなた.m2リポジトリの内容全体を削除し、Mavenのは、それらを再度ダウンロードするに依存している(.m2リポジトリが現在のユーザーのフォルダに、Windowsのセットアップで、発見されました。 にあります)
  • -Xオプションでビルドを再実行します。には、に問題の原因となっている特定のJarファイルの詳細が表示されます。その後、削除できるのはその1つだけです。

あなた.m2フォルダ内の任意のカスタムinstall秒を持っていない限り、私は1

関連する問題