【发布时间】:2016-06-02 18:42:03
【问题描述】:
打包的 WAR 中缺少 json-simple jar,因为它在 spring-boot-starter-parent 中标记为 optional,但我确实包含了一个依赖项 gelfj,它将 json-simple 声明为依赖项.....下面的示例(与 Maven 3.3.3 一起使用):
<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.giveandtake</groupId>
<artifactId>main</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.2.RELEASE</version>
</parent>
<name>main</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.graylog2</groupId>
<artifactId>gelfj</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j</artifactId>
<version>1.2.3.RELEASE</version>
</dependency>
</dependencies>
</project>
[1] 使用 maven 3.0.4 打包战争时,我得到了 json-simple 内部战争(没有明确要求 jar)。
[2] 使用 maven 3.3.x war 打包时,我的 war(除非我明确要求)文件中没有这个 jar。
这给我留下了这些问题:
问题 1:如果我有 ProjectX-->(Inherit)Spring-boot-Parent 并且还声明了一个依赖于 json-simple 的依赖项 Y,那么 simple-json 的依赖项不应该是过渡到战争并认识到这不再是可选的?
问题2:为什么不同的maven版本会出现不同的结果【maven bug? ,搜索了发行说明,但没有找到任何匹配的内容]
【问题讨论】:
-
Spring Boot中这个问题的详细信息:stackoverflow.com/q/38555184/466738和github.com/spring-projects/spring-boot/issues/6450。将在 Spring Boot 1.3.7 中修复
标签: maven spring-boot maven-3 war maven-war-plugin