Maven学习之16指定jdk版本

1.加入插件,修改版本就行了

	          <plugin>
<span style="white-space:pre">				</span><groupId>org.apache.maven.plugins</groupId>
<span style="white-space:pre">				</span><artifactId>maven-compiler-plugin</artifactId>
<span style="white-space:pre">				</span><version>3.3</version>
<span style="white-space:pre">				</span><configuration>
<span style="white-space:pre">					</span><source>1.7</source>
<span style="white-space:pre">					</span><target>1.7</target>
<span style="white-space:pre">				</span></configuration>
<span style="white-space:pre">			</span></plugin>

需要刷新project,后面的都是记录

2.运行package:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WebTest Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact servletapi:servletapi:jar:2.4 has been relocated to javax.servlet:servlet-api:jar:2.4
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ WebTest ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ WebTest ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to D:\all\eclipse432\WebTest\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ WebTest ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\all\eclipse432\WebTest\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ WebTest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ WebTest ---
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ WebTest ---
[INFO] Packaging webapp
[INFO] Assembling webapp [WebTest] in [D:\all\eclipse432\WebTest\target\WebTest]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\all\eclipse432\WebTest\src\main\webapp]
[INFO] Webapp assembled in [74 msecs]
[INFO] Building war: D:\all\eclipse432\WebTest\target\WebTest.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.818 s
[INFO] Finished at: 2016-05-11T02:34:46+08:00
[INFO] Final Memory: 16M/167M
[INFO] ------------------------------------------------------------------------

3.完整pom记录:

<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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.ms.bop</groupId>
	<artifactId>WebTest</artifactId>
	<packaging>war</packaging>
	<version>0.0.1-SNAPSHOT</version>
	<name>WebTest Maven Webapp</name>
	<url>http://maven.apache.org</url>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>servletapi</groupId>
			<artifactId>servletapi</artifactId>
			<version>2.4</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>jsp-api</artifactId>
			<version>2.2</version>
			<scope>provided</scope>
		</dependency>
		<!-- <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId>
			</dependency> -->

	</dependencies>

	<build>
		<finalName>WebTest</finalName>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.3</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
			<!-- <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId>
				<version>8.1.16.v20140903</version> <configuration> <scanIntervalSeconds>5</scanIntervalSeconds>
				<webApp> <contextPath>/WebTest</contextPath> </webApp> </configuration> </plugin> -->
		</plugins>
	</build>
</project>
时间: 2024-10-24 23:44:45

Maven学习之16指定jdk版本的相关文章

maven设置指定jdk版本

今天心血来潮准备折腾一下jeecg,去下载了一个maven版本的项目,既然下载了maven版的,单人就要配置好maven环境了. 因为之前简单学习过maven,当时使用的版本是3.3.9的,但是今天在cmd下直接运行 mvn -v 报java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0 一看就知道了是JDK版本不对,因为我环境变量配置

Maven配置默认使用的JDK版本

问题: 创建maven项目的时候,jdk版本是1.7版本,而自己安装的是1.8版本,从而导致无法使用lambda等Java8新特性. 每次右键项目名-maven->update project 时候,项目jdk版本就会变回1.7版本. 解决办法: 解决办法一:在项目中的pom.xml指定jdk版本 <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> &

linux 安装jdk及tomcat指定jdk版本推荐

方法1:用yum命令安装 1.   查看当前jdk版本:Java –version,或者是:rpm -qa | grep jdk 2.   删除当前jdk:yum -y remove java-1.6.0-openjdk 3.   查看yum软件库中可用的jdk版本:yum search  jdk 4.   安装Java1.7版本: yum install java-1.7.0-openjdk yum install java-1.7.0-openjdk-devel 默认安装到/usr目录下.

linux 安装jdk及tomcat指定jdk版本

方法1:用yum命令安装 1.   查看当前jdk版本:Java –version,或者是:rpm -qa | grep jdk 2.   删除当前jdk:yum -y remove java-1.6.0-openjdk 3.   查看yum软件库中可用的jdk版本:yum search  jdk 4.   安装Java1.7版本: yum install java-1.7.0-openjdk yum install java-1.7.0-openjdk-devel 默认安装到/usr目录下.

maven 指定 jdk 版本

方法1:直接修改 本地  settings.xml 文件 <profiles>  </profiles> 之间加入 下面的 <profile> <id>jdk-1.8</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.8</jdk> </activation> <properties>

linux下部署tomcat指定JDK版本编译并运行javaWEB应用

1.linux系统环境信息 [[email protected] ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.4 (Tikanga) [[email protected] home]# uname -a Linux softtest 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux 2.t

Eclipse指定JDK版本 Failed to load the JNI shared JVM.dll

打开eclipse.ini添加 -vm C:/Java/jdk1.6.0_02/bin 参考:http://my.oschina.net/liangzhenghui/blog/277647 Failed to load the JNI shared JVM.dll 原因1:给定目录下jvm.dll不存在. 对策:(1)重新安装jre或者jdk并配置好环境变量.(2)copy一个jvm.dll放在该目录下. 原因2:eclipse的版本与jre或者jdk版本不一致 对策:要么两者都安装64位的,要

eclipse指定jdk版本

背景:机器上装有jdk7和8两个版本,命令行中查看java版本为1.7,而neon对jdk的版本要求是1.8,又不想修改系统默认的jdk版本. 解决方法:eclipse安装目录下找到eclipse.ini文件,增加如下参数: -vmD:\java\jdk1.8\bin 完整文件: -startup plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar --launcher.library plugins/org.eclip

maven工程指定jdk版本

方法1: 在conf文件夹下找到settings.xml在profiles 节点下增加: <profile> <id>jdk-1.7</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.7</jdk> </activation> <properties> <maven.compiler.source>