我正在关注春季官方指南:
http://projects.spring.io/spring-boot
Apache Maven 3.1.0
Maven home: /Users/abshammeri/apps/apache-maven-3.1.0
Java version: 1.7.0_11, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac"
<groupId>org.test</groupId>
<artifactId>example</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.6.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<properties>
<start-class>hello.Application</start-class>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
package hello;
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;
@Controller
@EnableAutoConfiguration
public class SampleController {
@RequestMapping("/")
@ResponseBody
String home() {
return "Hello World!";
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleController.class, args);
}
}
但每次尝试使用mvn package && java -jar example.jar
和apache maven 3
{/ 1}} {/ 1}}时,我都会收到以下例外情况,
java 1.7
谢谢,
答案 0 :(得分:2)
我会根据@AndyWilkinson在问题评论中提到的有用说明来回答我的问题,/Library/Java/Extensions/
中有旧的春季罐子(3.2)(它是&#39; s MAC OSX路径),我已将其删除。现在java加载apache Maven
罐子。