首页 > 其他分享 >修改maven3项目的默认的编译级别(compile level)

修改maven3项目的默认的编译级别(compile level)

时间:2023-04-20 11:37:36浏览次数:35  
标签:xml maven 1.6 项目 maven3 level jre compile archetype


评:


听闻maven的鼎鼎大名打算在最近的一个项目中试下爽,结果遇到了这个问题,虽对项目影响不大,但做技术刨根问题是必须的了,少废话。

1.cmd命令建立web项目:mvn archetype:generate -DgroupId=biz.yunduo -DartifactId=dts -DpackageName=dts -DarchetypeArtifactId=maven-archetype-webapp

2.如下图,eclipse3.6 For javaEE下有个警告,意思是项目Build path指定的jre是j2se1.5但是找不到与此版本严格匹配的jre
3.纠结了好长时间,不如看看maven的配置文件吧。打开%maven_home%\conf\setting.xml

在<profiles>标签内添加如下配置:

<profile> 

 <id>jdk-1.6</id> 

 <activation> 

 <activeByDefault>true</activeByDefault> 

 <jdk>1.6</jdk> 

 </activation> 

 <properties> 

 <maven.compiler.source>1.6</maven.compiler.source> 

 <maven.compiler.target>1.6</maven.compiler.target> 

 <maven.compiler.compilerVersion>1.6</maven.compiler.compilerVersion> 

 </properties> 

</profile>



以后再使用maven生成项目默认编译级别就是1.6的了

4.如果你有特别的需要,比如不同的项目使用的jre不同那么可以在项目的pom.xml里添加如下配置:

<build> 


 <plugins> 


 <plugin> 


 <groupId>org.apache.maven.plugins</groupId> 


 <artifactId>maven-compiler-plugin</artifactId> 


 <configuration> 


 <source>1.6</source> 


 <target>1.6</target> 


 </configuration> 


 </plugin> 


 </plugins> 


</build>

标签:xml,maven,1.6,项目,maven3,level,jre,compile,archetype
From: https://blog.51cto.com/u_16080829/6209264

相关文章

  • LLVM(Low Level Virtual Machine)
    LLVM(LowLevelVirtualMachine)是一个开源的编译器基础设施项目,旨在提供一个可扩展、灵活和高效的编译器框架。LLVM的设计目标是提供一种中立于目标平台的IR(IntermediateRepresentation)表示方法,使得编译器开发人员可以更加容易地实现跨平台的代码生成器和优化器。LLVM项目包......
  • Sql Isolation Level
    隔离性(Isolation):与数据库中的事务隔离级别以及锁相关,多个用户可以对同一数据并发访问而又不破坏数据的正确性和完整性。但是并行事务的修改必须与其他并行事务的修改相互独立,隔离。但是在不同的隔离级别下,事务的读取操作可能得到的结果是不同的。隔离级别用于决定如何控制并......
  • android: minSdkVersion、targetSdkVersion、CompileSdkVersion三个api版本号的区别
    一,minSdkVersion:   app可以安装的最低的api版本:   1,安装:googleplay和应用市场会根据用户的api版本,           判断用户是否可以看到你的app    2, 运行:在minSdkVersion指定版本的api上运行时,           ......
  • Angular 复习与进阶系列 – Angular Compiler (AKA ngc)
    前言在GetStarted那一篇,我们有提到过 AngularCompilation.这篇稍微给点具体画面,让大家感受一下.但不会讲细节,对细节感兴趣的可以看Medium– HowtheAngularCompilerWorks ......
  • python compile函数用法
    将文本代码编译成Python可执行代码,这个代码对象可以通过eval()或exec()函数执行。compile()函数的语法如下:compile(source,filename,mode,flags=0,dont_inherit=False,optimize=-1)参数说明:source:必选.必须是一个字符串,表示要编译的代码。filename:必选? 表示......
  • Understanding the different flavors of Clang C and C++ compilers in Windows
    https://blog.conan.io/2022/10/13/Different-flavors-Clang-compiler-Windows.htmlThisarticlewillexplainthedifferentflavorsofClangCandC++compileryoumightencounterinWindows,andgiveyousomesuggestionsaboutwhichonesmightberightforyo......
  • .Net Standard-Missing compiler member error Microsoft.CSharp.RuntimeBinder.CShar
     最近在玩dynamic的时候出现无法生成的情况."missingcompilermembererrorMicrosoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create"   解决方案:缺少Nuget包: Microsoft.CSharp ......
  • DDR4 拓扑 DDR 学习时间 (Part B - 3):Write Leveling
        https://zhuanlan.zhihu.com/p/348360737https://blog.csdn.net/jsf120/article/details/113986468    ......
  • Centos7 安装 maven3.6.3
    1.下载maven3.6.3安装包wgethttps://mirrors.ocf.berkeley.edu/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz--no-check-certificate2.创建一个安装maven的目录mkdir/usr/local/maven3.解压下载的软件包tar-zxvfapache-maven-3.6.3-bi......
  • 为什么有的板子不用设置arch、cross_compile环境变量
    学习地址......