更改Maven工程默认的JDK版本

修改Maven中conf目录里的setting.xml文件内容,加上如下内容:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
< profiles >
        
         < profile >
             < id >jdk-1.8 id >
             < activation >
                 < activeByDefault >true activeByDefault >
                 < jdk >1.8 jdk >
             activation >
             < properties
                 < maven.compiler.source >1.8 maven.compiler.source
                 < maven.compiler.target >1.8 maven.compiler.target
                 < maven.compiler.compilerVersion >1.8 maven.compiler.compilerVersion
             properties >
             < repositories >
                 < repository >
                     < id >nexus id >
                     < name >local private nexus name >
                     < url >http://maven.oschina.net/content/groups/public/ url >
                     < releases >
                         < enabled >true enabled >
                     releases >
                     < snapshots >
                         < enabled >false enabled >
                     snapshots >
                 repository >
             repositories >
             < pluginRepositories >
                 < pluginRepository >
                     < id >nexus id >
                     < name >local private nexus name >
                     < url >http://maven.oschina.net/content/groups/public/ url >
                     < releases >
                         < enabled >true enabled >
                     releases >
                     < snapshots >
                         < enabled >false enabled >
                     snapshots >
                 pluginRepository >
             pluginRepositories >
         profile >
 
 
        
     profiles >



其中的1.8修改为你需要的jdk版本号,然后在eclipse里的项目右击鼠标-Maven-select Maven profiles,选择对应的jdk参数,然后更新项目就可以了

你可能感兴趣的:(java,maven,工程默认版本号,*JAVA)