将org.springframework.boot的更新版本更新为1.3.2

时间:2016-02-12 15:10:10

标签: java maven spring-boot

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

    ...
<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

我做错了什么?

1 个答案:

答案 0 :(得分:3)

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

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