2016-05-04 11 views
0

Mavenのインストールを実行しているとき、私は、次の不可解なエラーメッセージを取得SurefireReflectionException

org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null 
java.lang.reflect.InvocationTargetException 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) 
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) 
    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175) 
    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:123) 
    at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:86) 
    at org.eclipse.tycho.surefire.osgibooter.HeadlessTestApplication.run(HeadlessTestApplication.java:21) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587) 
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198) 
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) 
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) 
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380) 
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669) 
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608) 
    at org.eclipse.equinox.launcher.Main.run(Main.java:1515) 
    at org.eclipse.equinox.launcher.Main.main(Main.java:1488) 
Caused by: java.lang.NullPointerException 
    at java.util.Objects.requireNonNull(Unknown Source) 
    at java.lang.Class.getAnnotation(Unknown Source) 
    at org.apache.maven.surefire.common.junit4.JUnit4TestChecker.isValidJUnit4Test(JUnit4TestChecker.java:63) 
    at org.apache.maven.surefire.common.junit4.JUnit4TestChecker.accept(JUnit4TestChecker.java:52) 
    at org.apache.maven.surefire.util.DefaultDirectoryScanner.locateTestClasses(DefaultDirectoryScanner.java:80) 
    at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:174) 
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:83) 
    ... 28 more 

は私の効果的なポンポンは、この(非常に大きい:-()のようになります。注目に値するかもしれない

<?xml version="1.0"?> 
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>group</groupId> 
    <artifactId>project</artifactId> 
    <version>1.1.0-SNAPSHOT</version> 
    <packaging>eclipse-test-plugin</packaging> 
    <properties> 
    <xtext.version>2.8.4</xtext.version> 
    <tycho-version>0.20.0</tycho-version> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 
    <pluginRepositories> 
    <pluginRepository> 
     <releases> 
     <updatePolicy>never</updatePolicy> 
     </releases> 
     <snapshots> 
     <enabled>false</enabled> 
     </snapshots> 
     <id>central</id> 
     <name>Central Repository</name> 
     <url>https://repo.maven.apache.org/maven2</url> 
    </pluginRepository> 
    </pluginRepositories> 
    <build> 
    <pluginManagement> 
     <plugins> 
     <plugin> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.3</version> 
     </plugin> 
     <plugin> 
      <artifactId>maven-assembly-plugin</artifactId> 
      <version>2.2-beta-5</version> 
     </plugin> 
     <plugin> 
      <artifactId>maven-dependency-plugin</artifactId> 
      <version>2.8</version> 
     </plugin> 
     <plugin> 
      <artifactId>maven-release-plugin</artifactId> 
      <version>2.3.2</version> 
     </plugin> 
     <plugin> 
      <groupId>org.eclipse.xtend</groupId> 
      <artifactId>xtend-maven-plugin</artifactId> 
      <version>2.8.4</version> 
      <executions> 
      <execution> 
       <goals> 
       <goal>compile</goal> 
       <goal>xtend-install-debug-info</goal> 
       <goal>testCompile</goal> 
       <goal>xtend-test-install-debug-info</goal> 
       </goals> 
       <configuration> 
       <outputDirectory>xtend-gen</outputDirectory> 
       </configuration> 
      </execution> 
      </executions> 
      <configuration> 
      <outputDirectory>xtend-gen</outputDirectory> 
      </configuration> 
     </plugin> 
     </plugins> 
    </pluginManagement> 
    <plugins> 
     <plugin> 
     <groupId>org.eclipse.tycho</groupId> 
     <artifactId>tycho-maven-plugin</artifactId> 
     <version>0.20.0</version> 
     <extensions>true</extensions> 
     </plugin> 
     <plugin> 
     <groupId>org.eclipse.tycho</groupId> 
     <artifactId>target-platform-configuration</artifactId> 
     <version>0.20.0</version> 
     <configuration> 
      <environments> 
      <environment> 
       <os>linux</os> 
       <ws>gtk</ws> 
       <arch>x86</arch> 
      </environment> 
      <environment> 
       <os>linux</os> 
       <ws>gtk</ws> 
       <arch>x86_64</arch> 
      </environment> 
      <environment> 
       <os>win32</os> 
       <ws>win32</ws> 
       <arch>x86</arch> 
      </environment> 
      <environment> 
       <os>macosx</os> 
       <ws>cocoa</ws> 
       <arch>x86_64</arch> 
      </environment> 
      </environments> 
     </configuration> 
     </plugin> 
     <plugin> 
     <groupId>org.eclipse.tycho</groupId> 
     <artifactId>tycho-surefire-plugin</artifactId> 
     <version>0.20.0</version> 
     <executions> 
      <execution> 
      <id>default-test</id> 
      <phase>integration-test</phase> 
      <goals> 
       <goal>test</goal> 
      </goals> 
      <configuration> 
       <skipTests>false</skipTests> 
      </configuration> 
      </execution> 
     </executions> 
     <configuration> 
      <skipTests>false</skipTests> 
     </configuration> 
     </plugin> 
     <plugin> 
     <artifactId>maven-clean-plugin</artifactId> 
     <version>2.5</version> 
     <executions> 
      <execution> 
      <id>default-clean</id> 
      <phase>clean</phase> 
      <goals> 
       <goal>clean</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-resources-plugin</artifactId> 
     <version>2.4.3</version> 
     <executions> 
      <execution> 
      <id>default-testResources</id> 
      <phase>process-test-resources</phase> 
      <goals> 
       <goal>testResources</goal> 
      </goals> 
      </execution> 
      <execution> 
      <id>default-resources</id> 
      <phase>process-resources</phase> 
      <goals> 
       <goal>resources</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <groupId>org.eclipse.tycho</groupId> 
     <artifactId>tycho-packaging-plugin</artifactId> 
     <version>0.20.0</version> 
     <executions> 
      <execution> 
      <id>default-package-plugin</id> 
      <phase>package</phase> 
      <goals> 
       <goal>package-plugin</goal> 
      </goals> 
      </execution> 
      <execution> 
      <id>default-build-qualifier</id> 
      <phase>validate</phase> 
      <goals> 
       <goal>build-qualifier</goal> 
      </goals> 
      </execution> 
      <execution> 
      <id>default-validate-id</id> 
      <phase>validate</phase> 
      <goals> 
       <goal>validate-id</goal> 
      </goals> 
      </execution> 
      <execution> 
      <id>default-validate-version</id> 
      <phase>validate</phase> 
      <goals> 
       <goal>validate-version</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <groupId>org.eclipse.tycho</groupId> 
     <artifactId>tycho-p2-plugin</artifactId> 
     <version>0.20.0</version> 
     <executions> 
      <execution> 
      <id>default-p2-metadata-default</id> 
      <phase>package</phase> 
      <goals> 
       <goal>p2-metadata-default</goal> 
      </goals> 
      </execution> 
      <execution> 
      <id>default-update-local-index</id> 
      <phase>install</phase> 
      <goals> 
       <goal>update-local-index</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <groupId>org.eclipse.tycho</groupId> 
     <artifactId>tycho-compiler-plugin</artifactId> 
     <version>0.20.0</version> 
     <executions> 
      <execution> 
      <id>default-compile</id> 
      <phase>compile</phase> 
      <goals> 
       <goal>compile</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-install-plugin</artifactId> 
     <version>2.3.1</version> 
     <executions> 
      <execution> 
      <id>default-install</id> 
      <phase>install</phase> 
      <goals> 
       <goal>install</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
    </plugins> 
    </build> 
</project> 

何されます

答えて

1

JUnit JARが少なくともテストスコープの依存関係であることを確認してください。スタックトレースから、Tycoが確実に動作していることから問題が発生しているように見えます。 JUnit4TestCheckerのrunWithがヌルで、hereからロードされているため、NPEが発生しています。

私はTychoについて知識がありませんが、プロジェクトではなく、タイコプラグイン自体にJUnit依存関係を追加することもできます。

+0

ちょっと、100%は分かりませんが、依存関係としてJUnitを追加するとおもしろくなります。私に出発点を与えてくれてありがとう。 –

+0

これが問題だったことが分かりました:https://issues.apache.org/jira/browse/SUREFIRE-825 Manifest.MFはorg.junitをインポートしていましたが、orgではありませんでした。 .junit.runnerも同様に:-) –

0

nullでない必要があるデータベース内にいくつかのエンティティがあるように見えますが、私が実行しようとしているテストは、Junit Plugin Testsです。 utはnullになります。 JUnitテストの実行中にこのメッセージが表示されますか?はいの場合、実際のコードでこのJunitで使用されるJunitテストとデータベースエンティティ/ SQLクエリを共有できますか?

+0

関連するデータベースはありません:/リポジトリから外部コードを読み込みますが、その手順はうまくいくようです。 –