2015-10-05 30 views
0

我遇到了一个问题,即我们的spring引导应用程序只能在包含子项目的情况下运行。粗略的草图项目:Spring引导REST应用程序在Eclipse中没有构建路径时无法运行

  • 后端

    这是主类是所在的位置。该项目还包含通过REST,过滤器和REST配置公开的spring库。数据本身包含在后端模块项目中。

  • 后端模块

    这是其保持数据的实际Java类的位置。它们与休眠一起使用。

现在,除非我删除了后端模块从Java构建路径在Eclipse项目的偏好应用工作正常。但是,如果我删除引用应用程序启动将失败,但不会从backendmodule缺少的组成部分,但丢失的春天启动组件:

Caused by: java.lang.NoClassDefFoundError: org/springframework/data/repository/support/RepositoryInvokerFactory 

该项目的pom.xml文件几乎是相同的。

我很乐意收录所有人可能需要的信息。 感谢

编辑1:

后端项目的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>backend</groupId> 
    <artifactId>Backend</artifactId> 
    <version>1.0</version> 
    <description>Rest Backend</description> 

    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.2.5.RELEASE</version> 
    </parent> 

    <properties> 
     <!-- use UTF-8 for everything --> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.apache.commons</groupId> 
      <artifactId>commons-io</artifactId> 
      <version>1.3.2</version> 
     </dependency> 

     <dependency> 
      <groupId>cis</groupId> 
      <artifactId>backend-module</artifactId> 
      <version>1.0</version> 
     </dependency> 

     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
      <version>4.2.12.Final</version> 
     </dependency> 

     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-spatial</artifactId> 
      <version>4.0</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-tomcat</artifactId> 
      <version>1.2.5.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-web</artifactId> 
      <version>1.2.5.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-test</artifactId> 
      <version>1.2.5.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-data-jpa</artifactId> 
      <version>1.2.5.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-data-rest</artifactId> 
      <version>1.2.5.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.data</groupId> 
      <artifactId>spring-data-rest-webmvc</artifactId> 
      <version>2.3.2.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-legacy</artifactId> 
      <version>1.0.1.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.data</groupId> 
      <artifactId>spring-data-commons-core</artifactId> 
      <version>1.4.1.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-entitymanager</artifactId> 
      <version>4.2.12.Final</version> 
     </dependency> 

     <dependency> 
      <groupId>postgresql</groupId> 
      <artifactId>postgresql</artifactId> 
      <version>9.1-901-1.jdbc4</version> 
     </dependency> 

     <dependency> 
      <groupId>org.postgis</groupId> 
      <artifactId>postgis-jdbc</artifactId> 
      <version>1.5.2</version> 
     </dependency> 

     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.17</version> 
     </dependency> 

     <dependency> 
      <groupId>org.antlr</groupId> 
      <artifactId>ST4</artifactId> 
      <version>4.0.8</version> 
     </dependency> 

     <dependency> 
      <groupId>jdom</groupId> 
      <artifactId>jdom</artifactId> 
      <version>1.1</version> 
     </dependency> 

     <dependency> 
      <groupId>com.fasterxml.jackson.dataformat</groupId> 
      <artifactId>jackson-dataformat-xml</artifactId> 
      <version>2.5.3</version> 
     </dependency> 

     <dependency> 
      <groupId>org.codehaus.woodstox</groupId> 
      <artifactId>woodstox-core-asl</artifactId> 
      <version>4.4.1</version> 
     </dependency> 

     <dependency> 
      <groupId>cis.adapter</groupId> 
      <artifactId>CISConnector</artifactId> 
      <version>1.0</version> 
     </dependency> 

     <dependency> 
      <groupId>cis.adapter</groupId> 
      <artifactId>CISCore</artifactId> 
      <version>1.0</version> 
     </dependency> 

     <dependency> 
      <groupId>com.google</groupId> 
      <artifactId>caplibrary</artifactId> 
      <version>r11</version> 
     </dependency> 

    </dependencies> 

    <repositories> 
     <repository> 
      <id>org.jboss.repository.releases</id> 
      <name>JBoss Maven Release Repository</name> 
      <url>https://repository.jboss.org/nexus/content/repositories/releases</url> 
     </repository> 
     <repository> 
      <id>OSGEO GeoTools repo</id> 
      <url>http://download.osgeo.org/webdav/geotools</url> 
     </repository> 
     <repository> 
      <id>Hibernate Spatial repo</id> 
      <url>http://www.hibernatespatial.org/repository</url> 
     </repository> 
    </repositories> 

    <pluginRepositories> 
     <pluginRepository> 
      <id>spring-releases</id> 
      <name>Spring Releases</name> 
      <url>https://repo.spring.io/libs-release</url> 
     </pluginRepository> 
    </pluginRepositories> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
       <version>1.2.6.RELEASE</version> 
       <executions> 
        <execution> 
         <goals> 
          <goal>repackage</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 

</project> 
+0

在eclipse中,您可以检查依赖关系层次结构,您应该在删除模块之前和之后对其进行比较。或者,您可以使用'mvn dependency:tree'并检查您的依赖关系。 –

+0

我从构建路径中删除后端模块后检查了树,它们没有区别。他们不应该依赖于java构建路径,他们应该如何? – Baiteman

+0

哦,我现在看到,你在eclipse中手动添加模块。这当然是个问题,因为你已经有了一个maven项目,所以你应该从你的'pom.xml'中引用它。将后端模块转换为Maven项目并将其安装到本地存储库中,以便您可以在IDE外构建后端。 –

回答

0

显然,问题是通过固定在pom.xml文件下降了很多版本的语句和升级春季引导到最新版本。

如果我正确理解了匆忙给出的解释,我们的Spring启动版本没有包含一些Spring组件的正确版本。

对不起,如果有人有类似的问题,并认为这个答案不够。

相关问题