2016-02-12 45 views
1

我使用org.springframework.boot版本1.2.5。发布和应用程序运行时没有错误。现在我想将org.springframework.boot的更改版本改为1.3.2。 我的POM文件是将org.springframework.boot的更新版本更新为1.3.2

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

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
    <java.version>1.8</java.version> 
    <docker.image.prefix>springio</docker.image.prefix> 
</properties> 

<dependencies> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-mongodb</artifactId>     
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-security</artifactId>   
    </dependency> 

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

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId>   
     <scope>test</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-actuator</artifactId>      
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-solr</artifactId>   
    </dependency>   

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-mail</artifactId>   
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-velocity</artifactId>   
    </dependency> 



    <dependency> 
     <groupId>com.google.guava</groupId> 
     <artifactId>guava</artifactId> 
     <version>18.0</version> 
    </dependency>  

    <dependency> 
     <groupId>com.jayway.jsonpath</groupId> 
     <artifactId>json-path</artifactId> 
     <version>2.1.0</version> 
     <scope>test</scope> 
    </dependency>  

    <dependency> 
     <groupId>commons-io</groupId> 
     <artifactId>commons-io</artifactId> 
     <version>2.1</version> 
    </dependency> 

    <dependency> 
     <groupId>net.sf.opencsv</groupId> 
     <artifactId>opencsv</artifactId> 
     <version>2.3</version> 
    </dependency> 

</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.5</version> 
      <configuration> 
       <source>1.8</source> 
       <target>1.8</target> 
      </configuration> 
     </plugin>   
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId>   
     </plugin> 

     <plugin> 
      <groupId>com.github.trecloux</groupId> 
      <artifactId>yeoman-maven-plugin</artifactId> 
      <version>0.4</version> 
      <executions> 
       <execution> 
        <phase>generate-resources</phase> 
        <goals> 
         <goal>build</goal> 
        </goals> 
        <configuration> 
         <bowerInstallArgs>install --no-color</bowerInstallArgs> 
         <buildArgs>build --force --no-color</buildArgs> 
         <!--<skipTests>true</skipTests>--> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 

     <plugin> 
      <groupId>com.spotify</groupId> 
      <artifactId>docker-maven-plugin</artifactId> 
      <version>0.2.11</version> 
      <configuration> 
       <imageName>${docker.image.prefix}/${project.artifactId}</imageName> 
       <dockerDirectory>src/main/docker</dockerDirectory> 
       <resources> 
        <resource> 
         <targetPath>/</targetPath> 
         <directory>${project.build.directory}</directory> 
         <include>${project.build.finalName}.jar</include> 
        </resource> 
       </resources> 
      </configuration> 
     </plugin>   

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.19</version><!--$NO-MVN-MAN-VER$--> 
      <configuration> 
       <includes> 
        <include>%regex[.*Test.*]</include> 
       </includes> 
      </configuration> 
     </plugin>   

    </plugins> 
</build>... 

和应用无差错运行。 但是,当我改变org.springframework.boot的版本1.3.2

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

我得到错误

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.actuate.system.ApplicationPidListener 
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_51] 
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_51] 
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_51] 
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_51] 
at org.springframework.util.ClassUtils.forName(ClassUtils.java:250) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:407) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE] 
... 34 common frames omitted 

我在做什么错?

+0

你是否清理目标目录('mvn clean')? – jny

+0

是的。我叫'mvn clean',然后'mvn install'。运行测试时,'mvn install'命令出现错误。 –

回答

2

Spring Boot api文档指出ApplicationPidListener在1.2.0中已被弃用,支持ApplicationPidFileWriter,并明显在Spring Boot 1.3.x中删除。你在使用这个课程吗?你只向我们展示了你的POM,而不是你的弹簧配置。

你的POM没有问题。不要从Praveen进行建议编辑。跟踪您使用ApplicationPidListener的位置并将其更改为使用ApplicationPidFileWriter。

+0

谢谢!我在'spring.factories'文件中使用了'ApplicationPidListener'。将其更改为“ApplicationPidFileWriter”有所帮助 –