2014-05-01 16 views
10

ODPOWIEDŹ: Zmieniłem tag wersji z 0.0.1-SNAPSHOT na 1.0.2.RELEASE i zadziałało, zobacz odpowiedź poniżej.mvn spring-boot: run nie startuje wiosna

Postępuję zgodnie z tym documentation i utworzyłem Example.java zgodnie z instrukcjami. Po uruchomieniu mvn spring-boot:run wiosna się nie uruchamia, tylko mówi ZBUDOWANY SUKCES. Rozumiem, że Spring powinien zacząć, a Tomcat wyświetla stronę.

E:\workspace\SpringBoot>mvn spring-boot:run 
[INFO] Scanning for projects... 
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building myproject 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] >>> spring-boot-maven-plugin:1.1.0.BUILD-SNAPSHOT:run (default-cli) @ myproject >>> 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ myproject --- 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] skip non existing resourceDirectory E:\workspace\SpringBoot\src\main\resources 
[INFO] skip non existing resourceDirectory E:\workspace\SpringBoot\src\main\resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ myproject --- 
[INFO] Nothing to compile - all classes are up to date 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ myproject --- 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] skip non existing resourceDirectory E:\workspace\SpringBoot\src\test\resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ myproject --- 
[INFO] No sources to compile 
[INFO] 
[INFO] <<< spring-boot-maven-plugin:1.1.0.BUILD-SNAPSHOT:run (default-cli) @ myproject <<< 
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.1.0.BUILD-SNAPSHOT:run (default-cli) @ myproject --- 
[INFO] Attaching agents: [] 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 2.108 s 
[INFO] Finished at: 2014-05-01T14:54:26-05:00 
[INFO] Final Memory: 16M/232M 
[INFO] ------------------------------------------------------------------------ 

Oto kilka szczegółów:

E:\workspace\SpringBoot>java -version 
java version "1.7.0_21" 
Java(TM) SE Runtime Environment (build 1.7.0_21-b11) 
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode) 

E:\workspace\SpringBoot>mvn -v 
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T12:37:52-05:00) 
Maven home: E:\apps\apache-maven-3.2.1\bin\.. 
Java version: 1.7.0_21, vendor: Oracle Corporation 
Java home: C:\Program Files\Java\jdk1.7.0_21\jre 
Default locale: en_US, platform encoding: Cp1252 
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows" 

Example.java zlokalizowane w E: \ workspace \ SpringBoot \ src \ main \ java:

import org.springframework.boot.*; 
import org.springframework.boot.autoconfigure.*; 
import org.springframework.stereotype.*; 
import org.springframework.web.bind.annotation.*; 

@RestController 
@EnableAutoConfiguration 
public class Example { 

    @RequestMapping("/") 
    String home() { 
     return "Hello World!"; 
    } 

    public static void main(String[] args) throws Exception { 
     SpringApplication.run(Example.class, args); 
    } 

} 

pom.xml się w E : \ workspace \ SpringBoot:

<?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.example</groupId> 
    <artifactId>myproject</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 

    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.1.0.BUILD-SNAPSHOT</version> 
    </parent> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
     </plugins> 
    </build> 

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

    <!-- (you don't need this if you are using a .RELEASE version) --> 
    <repositories> 
     <repository> 
      <id>spring-snapshots</id> 
      <url>http://repo.spring.io/snapshot</url> 
      <snapshots><enabled>true</enabled></snapshots> 
     </repository> 
     <repository> 
      <id>spring-milestones</id> 
      <url>http://repo.spring.io/milestone</url> 
     </repository> 
    </repositories> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>spring-snapshots</id> 
      <url>http://repo.spring.io/snapshot</url> 
     </pluginRepository> 
     <pluginRepository> 
      <id>spring-milestones</id> 
      <url>http://repo.spring.io/milestone</url> 
     </pluginRepository> 
    </pluginRepositories> 

</project> 
+1

Wypróbuj w wersji wiosna-boot 1.0.2.RELEASE. "Uruchomione" mojo zmieniło się w migawkach wersji 1.1.0 i mogłeś trafić na specyficzny dla systemu Windows problem (wygląda na to, że aplikacja działa, ale nie widzisz wyjścia konsoli). –

+0

Awesome to worked! Wiosna zaczęła się i strona jest już obsługiwana! – szxnyc

+0

więc ... Właśnie zacząłem wiosenny boot, ale jaki URL mam zamiar sprawdzić? Poszedłem do localhost: 8080 i nie widzę niczego – mmcrae

Odpowiedz

7

Wypróbuj w wersji wiosna-boot 1.0.2.RELEASE. "Uruchomione" mojo zmieniło się w migawkach wersji 1.1.0 i mogłeś trafić na specyficzny dla systemu Windows problem (wygląda na to, że aplikacja działa, ale nie widzisz wyjścia konsoli).

Aktualizacja: ten błąd został naprawiony, więc powinien działać również w wersji 1.1.0.

2

Twój pom jest brakuje na wiosnę Boot Maven Plugin:

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
     </plugin> 
    </plugins> 
</build> 
+0

Gdzie mam to umieścić? Umieściłem go w moim pom.xml, ale uzyskałem ten sam wynik: – szxnyc

+0

Umieszczono go w swoim pom na tym samym poziomie co repozytoria/pluginRepositories/etc. Czy możesz opublikować zaktualizowaną wersję Pom? –

+0

Właśnie zaktualizowałem mój plik pom.xml w oryginalnym wpisie powyżej. – szxnyc

5

zmieniłem tag wersji od 0.0.1-SNAPSHOT do 1.0.2.RELEASE i to działało:

<?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.example</groupId> 
    <artifactId>myproject</artifactId> 
    <version>1.0.2.RELEASE</version> 

    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.1.0.BUILD-SNAPSHOT</version> 
    </parent> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
     </plugins> 
    </build> 

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

    <!-- (you don't need this if you are using a .RELEASE version) --> 
    <repositories> 
     <repository> 
      <id>spring-snapshots</id> 
      <url>http://repo.spring.io/snapshot</url> 
      <snapshots><enabled>true</enabled></snapshots> 
     </repository> 
     <repository> 
      <id>spring-milestones</id> 
      <url>http://repo.spring.io/milestone</url> 
     </repository> 
    </repositories> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>spring-snapshots</id> 
      <url>http://repo.spring.io/snapshot</url> 
     </pluginRepository> 
     <pluginRepository> 
      <id>spring-milestones</id> 
      <url>http://repo.spring.io/milestone</url> 
     </pluginRepository> 
    </pluginRepositories> 

</project> 

Wiosna teraz zacząć:

. ____   _   __ _ _ 
/\\/___'_ __ _ _(_)_ __ __ _ \ \ \ \ 
(()\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 
\\/ ___)| |_)| | | | | || (_| | )))) 
    ' |____| .__|_| |_|_| |_\__, |//// 
=========|_|==============|___/=/_/_/_/ 
:: Spring Boot :: (v1.1.0.BUILD-SNAPSHOT) 
Powiązane problemy