gs-access-data-jpa-0.1.0.jar目标jar中缺少SpringApplication.class

时间:2014-07-14 17:25:56

标签: java spring maven spring-boot

我正在使用Maven。 Pom附在下面。 Spring Source上Spring-boot页面的入门应用程序。 Application.java导入了它无法找到的SpringApplication。 Pom包含必要的(我相信;必须是错误的)spring-boot依赖项来下载它...

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <modelVersion>4.0.0</modelVersion>
    <groupId>org.springframework</groupId>
    <artifactId>gs-accessing-data-jpa</artifactId>
    <version>0.1.0</version>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.1.4.RELEASE</version>
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
    </dependencies>
    <properties>
        <!-- use UTF-8 for everything -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <start-class>hello.Application</start-class>
    </properties>
    <build>
        <plugins>
            <plugin> 
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>spring-releases</id>
            <name>Spring Releases</name>
            <url>http://repo.spring.io/libs-release</url>
        </repository>
        <repository>
            <id>org.jboss.repository.releases</id>
            <name>JBoss Maven Release Repository</name>
            <url>https://repository.jboss.org/nexus/content/repositories/releases</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <name>Spring Releases</name>
            <url>http://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>
</project>

结束POM。

生成的目标jar具有与spring相关的包,但org.springframework.boot包中包含SpringApplication.class等包含的是MISSING 。这是jar -tvf

的快照
317609 Mon Jul 14 10:10:28 PDT 2014 lib/spring-boot-1.1.4.RELEASE.jar
341668 Mon Jul 14 10:10:28 PDT 2014 lib/spring-boot-autoconfigure-1.1.4.RELEASE.jar
  2183 Mon Jul 14 10:10:28 PDT 2014 lib/spring-boot-starter-logging-1.1.4.RELEASE.jar
  2139 Mon Jul 14 10:10:28 PDT 2014 lib/spring-boot-starter-tomcat-1.1.4.RELEASE.jar
  2267 Mon Jul 14 10:10:28 PDT 2014 lib/spring-boot-starter-data-jpa-1.1.4.RELEASE.jar
  **2169 Mon Jul 14 10:10:28 PDT 2014 lib/spring-boot-starter-aop-1.1.4.RELEASE.jar
  2177 Mon Jul 14 10:10:28 PDT 2014 lib/spring-boot-starter-jdbc-1.1.4.RELEASE.jar
     0 Mon Jul 14 10:10:28 PDT 2014 org/springframework/boot/
     0 Mon Jul 14 10:10:28 PDT 2014 org/springframework/boot/loader/
  1722 Tue Jul 08 02:17:24 PDT 2014 org/springframework/boot/loader/PropertiesLauncher$ArchiveEntryFilter.class**
  1967 Tue Jul 08 02:17:24 PDT 2014 org/springframework/boot/loader/PropertiesLauncher$PrefixMatchingArchiveFilter.class

注意org / springframework / boot后跟NO类,然后打包org.springframework / boot / loader ......

我错过了什么?

1 个答案:

答案 0 :(得分:0)

运行mvn spring-boot:run 而不是

mvn clean install

是否有效。

Spring Boot这是一个伟大的项目;也使用Spring-Data。同样伟大 - 喜欢支持SQL和NoSQL(Mongo)DB的JPA抽象,语义非常相似!!

然而,有点担心的是:每一个新的Spring框架项目都会让我们远离“引擎盖下”#39;事情,我担心我们是否会在价值与清晰度比率下降的情况下增加太多的抽象层次。