2016-06-20 11 views
0

Ich habe ein Problem, das ich nicht lösen kann. Ich möchte ein Maven-Projekt in Eclipse importieren. Jedoch, wenn ich so tue ich von Eclipse folgenden Störung erhalte:Fehler beim Importieren von Maven-Projekt in Eclipse

enter image description here

Aber wenn ich in der Klemme „mvn install“ tue, ich bin in der Lage, erfolgreich das Projekt. Hier ist die pom.xml Datei:

<?xml version="1.0" encoding="UTF-8"?> 
<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>com.thinkaurelius.titan</groupId> 
    <artifactId>titan-web-example</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>war</packaging> 

    <description> 
     This is a simple web app example. 
    </description> 
    <licenses> 
     <license> 
      <name>The Apache Software License, Version 2.0</name> 
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> 
     </license> 
    </licenses> 

    <properties> 
     <spring.version>4.0.3.RELEASE</spring.version> 
     <titan.version>1.0.0</titan.version> 
    </properties> 

    <dependencies> 

     <dependency> 
      <groupId>com.thinkaurelius.titan</groupId> 
      <artifactId>titan-cassandra</artifactId> 
      <version>${titan.version}</version> 
      <exclusions> 
       <!-- These don't play well w/ the web classesthatrunthings deps below --> 
       <exclusion> 
        <groupId>org.mortbay.jetty</groupId> 
        <artifactId>servlet-api</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>javax.servlet</groupId> 
        <artifactId>servlet-api</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 

     <dependency> 
      <groupId>com.thinkaurelius.titan</groupId> 
      <artifactId>titan-es</artifactId> 
      <version>${titan.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>org.apache.tinkerpop</groupId> 
      <artifactId>gremlin-groovy</artifactId> 
      <version>3.0.0-incubating</version> 
     </dependency> 


     <!-- Web App --> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-core</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-context</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>org.jboss.resteasy</groupId> 
      <artifactId>jaxrs-api</artifactId> 
      <version>2.2.1.GA</version> 
     </dependency> 

     <dependency> 
      <groupId>com.sun.jersey</groupId> 
      <artifactId>jersey-server</artifactId> 
      <version>1.18.1</version> 
     </dependency> 

     <dependency> 
      <groupId>com.sun.jersey</groupId> 
      <artifactId>jersey-json</artifactId> 
      <version>1.18.1</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-web</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-aop</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 

     <!-- Jersey --> 
     <dependency> 
      <groupId>com.sun.jersey.contribs</groupId> 
      <artifactId>jersey-spring</artifactId> 
      <version>1.18.1</version> 
      <exclusions> 
       <!-- oh maven you crazy old bird! --> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-core</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-web</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-beans</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-context</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-aop</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 

     <!-- Jetty Embedded App Container --> 
     <!-- You only need this if you want to run the web app in the embedded jetty container using the RunApp class --> 
     <dependency> 
      <groupId>org.eclipse.jetty</groupId> 
      <artifactId>jetty-server</artifactId> 
      <version>9.2.0.v20140526</version> 
     </dependency> 

     <dependency> 
      <groupId>org.eclipse.jetty</groupId> 
      <artifactId>jetty-webapp</artifactId> 
      <version>9.2.0.v20140526</version> 
     </dependency> 

     <!-- Util --> 
     <dependency> 
      <groupId>commons-lang</groupId> 
      <artifactId>commons-lang</artifactId> 
      <version>2.4</version> 
     </dependency> 

     <dependency> 
      <groupId>com.google.code.gson</groupId> 
      <artifactId>gson</artifactId> 
      <version>2.2.4</version> 
     </dependency> 

     <!-- Groovy GMaven --> 
     <dependency> 
      <groupId>org.codehaus.gmaven</groupId> 
      <artifactId>gmaven-plugin</artifactId> 
      <version>1.4</version> 
     </dependency> 

    </dependencies> 

    <build> 
     <finalName>titan-web-example</finalName> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.4</version> 
      </plugin> 

      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.7</source> 
        <target>1.7</target> 
       </configuration> 
      </plugin> 

      <plugin> 
       <groupId>org.codehaus.gmaven</groupId> 
       <artifactId>gmaven-plugin</artifactId> 
       <version>1.4</version> 
       <configuration> 
        <providerSelection>1.8</providerSelection> 
       </configuration> 
       <executions> 
        <execution> 
         <goals> 
          <goal>generateStubs</goal> 
          <goal>compile</goal> 
          <goal>generateTestStubs</goal> 
          <goal>testCompile</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 

     </plugins> 
    </build> 

</project> 

Es sieht aus wie gmaven ein Problem in Eclipse hat, aber ich weiß nicht, wie das zu lösen.

+1

Das ist nur M2E, die nicht den richtigen Anschluss für GMaven Plugin hat .. nichts, was Sie dagegen tun können. M2E wird einfach nicht automatisch im Hintergrund dein Maven-Projekt aufbauen, aber das ist sowieso nur ein Sahnehäubchen auf dem Cupcake ... Schau dir das mal an http://stackoverflow.com/a/27939648/1743880, könnte dir helfen. – Tunaki

Antwort

1

Die Art, wie Eclipse Maven-Projekte behandelt, wird derzeit durch das m2e-Plugin erledigt.

m2e tut nicht aufrufen Maven darunter, aber analysiert die pom.xml-Dateien und für jedes Plugin erwähnten Code aufrufen explizit geschrieben, um sich in m2e als das Plugin identisch zu benehmen. Das ist ein "Connector".

Wenn ein Connector für ein bestimmtes Plugin nicht verfügbar ist (so dass m2e es für Sie emulieren kann), wird dieser Fehler angezeigt. Dies ist leider nicht ungewöhnlich für die selteneren Plugins.

Sie müssen untersuchen, ob es ausreicht, dass m2e genug vom Projekt präsentieren kann, damit Sie trotzdem arbeiten können, und dann nur echte Builds über die Befehlszeile ausführen.

Sie können auch eine andere freie IDE für solch ein problematisches Projekt in Betracht ziehen. Ich weiß, dass IntelliJ mit fast jeder pom.xml-Datei funktioniert, und mir wird gesagt, dass auch Netbeans das können.

Verwandte Themen