我有一个基于2.1.0.RELEASE的spring boot项目。 我想在运行Java1.7版本的Weblogic服务器上运行此项目。 我试图将pom.xml中的Java版本更改为 1.7 但这没用。
当我从项目中创建可执行jar时,仍然将build_jdk显示为1.8,因此我决定切换到Spring Boot较旧的版本1.4.0,希望它可以在Java 7上运行。但是,当我再次构建项目时,我不会在生成的jar的清单文件中看不到任何更改。它仍然显示Spring Boot版本为2.1.0.RELEASE。
有人能建议两件事之一吗?
这是我的pom.xml
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>parent-XYZ-package</groupId>
<artifactId>parent-XYZ-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>myProject</artifactId>
<name>myProject</name>
<url>http://maven.apache.org</url>
<properties>
<java.version>1.7</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
<configuration>
<archive>
<mainClass>MyMainClass</mainClass>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
**<dependency>
<groupId>DependentUserProjec</groupId>
<artifactId>DependentUserProject</artifactId>
<version>${project.version}</version>
</dependency>**
<dependency>
<groupId>weblogic</groupId>
<artifactId>wlfullclient</artifactId>
<version>12.1.2.0.0</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
还有一点要注意,我的pom.xml中已经有一个父pom 因此,我通过标签指定了springboot父依赖项。
更新
我在pom.xml中指定的哪个springboot版本始终使用Springboot 2.1.1.RELEASE
构建我的项目下面是我的清单文件中生成的快照
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: SID
Start-Class: myMainClass **This line is I have edited just to post on this site**
Spring-Boot-Classes: BOOT-INF/classes/
Spring-Boot-Lib: BOOT-INF/lib/
Spring-Boot-Version: 2.1.1.RELEASE
Created-By: Apache Maven 3.5.3
Build-Jdk: 1.8.0_181
Main-Class: org.springframework.boot.loader.JarLauncher