The project object model pom.xml

Figure 631. «Hello, world» pom.xml Slide presentation
<project xmlns="" 



Figure 632. Executing «compile» phase Slide presentation
mkdir -p src/main/java 

vim src/main/java/ 

first> mvn compile ...
[WARNING] File encoding has not been set, using platform encoding UTF-8, 
    i.e. build is platform dependent! ...
[ERROR] error: Source option 5 is no longer supported.  Use 6 or later.
[ERROR] error: Target option 1.5 is no longer supported.  Use 1.6 or later.

Create an empty folder designated for hosting Java sources. See Figure 627, “Maven project layout ” for reference.

Create an executable «Hello,world ...» class:

public class Hello {

   public static void main(String[] args) {

Ask Maven for execution of the «compile» phase.

We have not yet specified an encoding on project level. Thus two platforms using different encoding may provide different artifact outcomes.

The world has moved: Java 1.5 compilers are outdated.

Figure 633. Examining the Java version culprit Slide presentation
>mvn help:effective-pom

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

> find ~/.m2/repository/ -name maven-compiler-plugin\* ...
>jar -xf ~/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/3.7.0/maven-compiler-plugin-3.7.0.jar
>cat META-INF/maven/plugin.xml
<encoding implementation="java.lang.String" default-value="${}">${encoding}</encoding>
<source implementation="java.lang.String" default-value="1.5">${maven.compiler.source}</source>
<target implementation="java.lang.String" default-value="1.5">${}</target>

Figure 634. Resolving encoding / Java version issues Slide presentation
<project ... xsd/maven-4.0.0.xsd">

  </properties> ...
rm -rf ~/.m2/repository/
mvn compile;     find ~/.m2/repository/ -type f|wc -l

Figure 635. POM inheritance Slide presentation

Figure 636. The Super POM Slide presentation
jar -tf /usr/share/apache-maven-3.0.5/lib/maven-model-builder-3.0.5.jar


Figure 637. pom-4.0.0.xml content Slide presentation
...                          <!-- Does this ring a (security related?) bell? -->
    <name>Central Repository</name>
      <name>Central Repository</name>

Figure 638. Favour https in ~/.m2/settings.xml Slide presentation
<settings ... settings-1.0.0.xsd">

      <name>Maven Central: Favour https over http.</name>

Figure 639. Resolving to effective pom.xml Slide presentation
first> mvn help:effective-pom
... Effective POMs, after inheritance, interpolation, and profiles are applied:

<project xmlns="" ...>