1 00:00:00,000 --> 00:00:02,170 [No Audio] 2 00:00:02,170 --> 00:00:03,366 So we saw in the last video that 3 00:00:03,368 --> 00:00:05,744 we could quickly configure IntelliJ IDEA to use 4 00:00:05,744 --> 00:00:07,976 JDK 8 within the IDE itself. 5 00:00:07,976 --> 00:00:10,556 A better way to do this stuff, rather than setting it 6 00:00:10,556 --> 00:00:13,205 in IntelliJ IDEA directly is to go to the 7 00:00:13,205 --> 00:00:16,495 pom.xml file and set in Maven itself, in 8 00:00:16,495 --> 00:00:18,762 other words in the pom model itself. So to 9 00:00:18,762 --> 00:00:21,478 do this we just need to configure the compiler plugin. 10 00:00:21,478 --> 00:00:24,229 So you can do this if you have a build section 11 00:00:24,229 --> 00:00:26,029 in the pom file 12 00:00:26,029 --> 00:00:28,046 [No Audio] 13 00:00:28,046 --> 00:00:29,920 then, within here you can configure the different 14 00:00:29,920 --> 00:00:33,030 plugins that are used, for the plugin section. 15 00:00:33,030 --> 00:00:35,910 [No Audio] 16 00:00:35,910 --> 00:00:38,138 And here we can configure an individual plugin. 17 00:00:38,138 --> 00:00:39,878 So the plugin I'm going to configure 18 00:00:39,878 --> 00:00:45,003 as a groupId of org.apache.maven.plugins. 19 00:00:45,003 --> 00:00:47,114 This is basically where all the default 20 00:00:47,114 --> 00:00:48,914 out of the box Maven plugins reside. 21 00:00:48,914 --> 00:00:52,764 That's the groupId for those the artifactsId 22 00:00:52,764 --> 00:00:55,356 is the Maven compiler plugin. 23 00:00:55,356 --> 00:00:57,986 And you can see here IDEA's giving us all the artifacts 24 00:00:57,986 --> 00:01:00,506 that live within that groupId, which is very useful. 25 00:01:00,506 --> 00:01:02,705 So Maven compiler plugin is the compiler one, 26 00:01:02,705 --> 00:01:06,589 [No Audio] 27 00:01:06,589 --> 00:01:08,350 version 3.6.1. 28 00:01:08,350 --> 00:01:11,950 And then finally we can put in a configuration block. 29 00:01:11,950 --> 00:01:13,864 And this is really the reason why we've done 30 00:01:13,864 --> 00:01:17,428 this, because within here we can give direct property 31 00:01:17,428 --> 00:01:21,539 values to the compiler plugin itself, and the 32 00:01:21,539 --> 00:01:25,324 properties we're going to use as source 1.8. 33 00:01:25,324 --> 00:01:28,492 This means that it will accept 1.8 level source code. 34 00:01:28,492 --> 00:01:30,064 In other words we can use all the Java 8 35 00:01:30,064 --> 00:01:31,263 new features like streams 36 00:01:31,263 --> 00:01:33,547 [No Audio] 37 00:01:33,547 --> 00:01:37,036 and then target of the same. 38 00:01:37,036 --> 00:01:38,822 So this defines basically what the 39 00:01:38,836 --> 00:01:40,744 output is going to be. In other words the byte code. 40 00:01:40,744 --> 00:01:43,144 So the first one the source property defines the level 41 00:01:43,144 --> 00:01:45,354 for the source code and the second one the target 42 00:01:45,354 --> 00:01:48,064 one defines the level for the actual Byte code. 43 00:01:48,064 --> 00:01:49,768 So that's another way of being able to do that. 44 00:01:49,768 --> 00:01:51,592 And to be honest it's a much better way than 45 00:01:51,592 --> 00:01:54,604 configuring it by hand in the IDE itself because number 46 00:01:54,604 --> 00:01:56,863 one it makes things portable since you don't normally 47 00:01:56,863 --> 00:01:59,392 check in the configuration files for an IDE. 48 00:01:59,392 --> 00:02:01,300 So for example you should never normally see a 49 00:02:01,300 --> 00:02:03,652 IDEA folder checked into a project in the case 50 00:02:03,652 --> 00:02:06,390 of IDEA or .classpath and .project file. 51 00:02:06,390 --> 00:02:08,104 In the case of Eclipse, those should always 52 00:02:08,104 --> 00:02:10,228 be generated by the IDE when you import 53 00:02:10,228 --> 00:02:12,414 the project into the IDE itself. 54 00:02:12,414 --> 00:02:13,744 That's the first reason. 55 00:02:13,744 --> 00:02:15,520 And the second reason is that it then makes 56 00:02:15,520 --> 00:02:18,292 it possible from a build perspective as well. 57 00:02:18,292 --> 00:02:21,030 So in another words when I build within the IDE 58 00:02:21,030 --> 00:02:24,002 or when I build the command line, then the 59 00:02:24,016 --> 00:02:26,560 same JDK level settings are going to take effect. 60 00:02:26,560 --> 00:02:27,892 That's the reason for that. 61 00:02:27,892 --> 00:02:29,656 Anyway, now that we've done that, we know 62 00:02:29,656 --> 00:02:32,214 we've got portable builds, we can move on.