[No Audio]
So we saw in the last video that
we could quickly configure IntelliJ IDEA to use
JDK 8 within the IDE itself.
A better way to do this stuff, rather than setting it
in IntelliJ IDEA directly is to go to the
pom.xml file and set in Maven itself, in
other words in the pom model itself. So to
do this we just need to configure the compiler plugin.
So you can do this if you have a build section
in the pom file
[No Audio]
then, within here you can configure the different
plugins that are used, for the plugin section.
[No Audio]
And here we can configure an individual plugin.
So the plugin I'm going to configure
as a groupId of org.apache.maven.plugins.
This is basically where all the default
out of the box Maven plugins reside.
That's the groupId for those the artifactsId
is the Maven compiler plugin.
And you can see here IDEA's giving us all the artifacts
that live within that groupId, which is very useful.
So Maven compiler plugin is the compiler one,
[No Audio]
version 3.6.1.
And then finally we can put in a configuration block.
And this is really the reason why we've done
this, because within here we can give direct property
values to the compiler plugin itself, and the
properties we're going to use as source 1.8.
This means that it will accept 1.8 level source code.
In other words we can use all the Java 8
new features like streams
[No Audio]
and then target of the same.
So this defines basically what the
output is going to be. In other words the byte code.
So the first one the source property defines the level
for the source code and the second one the target
one defines the level for the actual Byte code.
So that's another way of being able to do that.
And to be honest it's a much better way than
configuring it by hand in the IDE itself because number
one it makes things portable since you don't normally
check in the configuration files for an IDE.
So for example you should never normally see a
IDEA folder checked into a project in the case
of IDEA or .classpath and .project file.
In the case of Eclipse, those should always
be generated by the IDE when you import
the project into the IDE itself.
That's the first reason.
And the second reason is that it then makes
it possible from a build perspective as well.
So in another words when I build within the IDE
or when I build the command line, then the
same JDK level settings are going to take effect.
That's the reason for that.
Anyway, now that we've done that, we know
we've got portable builds, we can move on.