diff --git a/Doc/Sd1/appendix.xml b/Doc/Sd1/appendix.xml index f967a0f76925589e5264c10110d71b6a9bf6e78b..c1550b413d84fdae57bbc0738775bb512f5184a6 100644 --- a/Doc/Sd1/appendix.xml +++ b/Doc/Sd1/appendix.xml @@ -9,7 +9,7 @@ xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> - <title xml:id="sd1Appendix"> Appendix</title> + <title xml:id="sd1Appendix">Appendix</title> <section xml:id="sd1ExaminationHints"> <title>Examination hints</title> @@ -2669,37 +2669,109 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <figure xml:id="sd1_fig_maven_helloWorldPom"> <title>»Hello, world« pom.xml</title> - <informaltable border="0"> - <tr> - <td valign="top"><programlisting language="xml"><project ... maven-4.0.0.xsd"> + <programlisting language="xml"><project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> <groupId>de.hdm_stuttgart.mi</groupId> <artifactId>first</artifactId> <version>0.9</version> -</project></programlisting></td> - - <td valign="top"><programlisting language="xml"><!-- maven-compiler-plugin: --> -<!-- META-INF/maven/plugin.xml --> -<source... default-value="1.5" - >${maven.compiler.source}</source> -<target... default-value="1.5" - >${maven.compiler.target}</target> -</programlisting></td> - </tr> - <tr> - <td colspan="2"><screen>first> mvn compile ... -[WARNING] File encoding has not been set, using platform encoding UTF-8, +</project></programlisting> + </figure> + + <figure xml:id="sd1_fig_maven_helloWorldPomExec"> + <title>»Hello, world« pom.xml</title> + + <screen>mkdir -p src/main/java <co + linkends="sd1_fig_maven_helloWorldPomExec-1" + xml:id="sd1_fig_maven_helloWorldPomExec-1-co"/> + +vim src/main/java/Hello.java <co linkends="sd1_fig_maven_helloWorldPomExec-2" + xml:id="sd1_fig_maven_helloWorldPomExec-2-co"/> + +first> mvn compile ... +[WARNING] <emphasis role="red">File encoding has not been set, using platform encoding UTF-8</emphasis>, <co + linkends="sd1_fig_maven_helloWorldPomExec-3" + xml:id="sd1_fig_maven_helloWorldPomExec-3-co"/> 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. -</screen></td> - </tr> - </informaltable> +[ERROR] error: <emphasis role="red">Source option 5 is no longer supported</emphasis>. <co + linkends="sd1_fig_maven_helloWorldPomExec-4" + xml:id="sd1_fig_maven_helloWorldPomExec-4-co"/> Use 6 or later. +[ERROR] error: <emphasis role="red">Target option 1.5 is no longer supported</emphasis>. <co + linkends="sd1_fig_maven_helloWorldPomExec-5" + xml:id="sd1_fig_maven_helloWorldPomExec-5-co"/> Use 1.6 or later. +</screen> + + <calloutlist role="slideExclude"> + <callout arearefs="sd1_fig_maven_helloWorldPomExec-1-co" + xml:id="sd1_fig_maven_helloWorldPomExec-1"> + <para>Create an empty folder designated for hosting <xref + linkend="glo_Java"/> sources. See <xref + linkend="sd1_fig_maven_ProjectLayout"/> for reference.</para> + </callout> + + <callout arearefs="sd1_fig_maven_helloWorldPomExec-2-co" + xml:id="sd1_fig_maven_helloWorldPomExec-2"> + <para>Create an executable »Hello,world ...« class:</para> + + <programlisting language="java">public class Hello { + + public static void main(String[] args) { + System.out.println("Hello!"); +}</programlisting> + </callout> + + <callout arearefs="sd1_fig_maven_helloWorldPomExec-3-co" + xml:id="sd1_fig_maven_helloWorldPomExec-3"> + <para>Ask <xref linkend="glo_Maven"/> for execution of the + »compile« phase.</para> + </callout> + + <callout arearefs="sd1_fig_maven_helloWorldPomExec-4-co" + xml:id="sd1_fig_maven_helloWorldPomExec-4"> + <para>We have not yet specified an encoding on project level. Thus + two platforms using different encoding may provide different + artifact outcomes.</para> + </callout> + + <callout arearefs="sd1_fig_maven_helloWorldPomExec-5-co" + xml:id="sd1_fig_maven_helloWorldPomExec-5"> + <para>The world has moved: <xref linkend="glo_Java"/> 1.5 + compilers are outdated.</para> + </callout> + </calloutlist> + </figure> + + <figure xml:id="sd1_fig_maven_simplePomJavaVersionPromlem"> + <title>Examining the <xref linkend="glo_Java"/> version + culprit</title> + + <screen>>mvn <emphasis role="red">help:effective-pom</emphasis> + +<project ...> + ... + <plugin> + <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</screen> + + <programlisting language="xml"><encoding implementation="java.lang.String" default-value="${<emphasis + role="red">project.build.sourceEncoding</emphasis>}">${encoding}</encoding> +<source implementation="java.lang.String" default-value="1.5">${<emphasis + role="red">maven.compiler.source</emphasis>}</source> +<target implementation="java.lang.String" default-value="1.5">${<emphasis + role="red">maven.compiler.target</emphasis>}</target></programlisting> </figure> <figure xml:id="sd1_fig_maven_simplePom"> - <title>Resolving encoding / version issues</title> + <title>Resolving encoding / <xref linkend="glo_Java"/> version + issues</title> <programlisting language="none"><project ... xsd/maven-4.0.0.xsd"> ... diff --git a/Doc/Sd1/arrays.xml b/Doc/Sd1/arrays.xml index 38919d440b87a8858a96c36525d68f2e1ee2dd30..992023e30e14c25c71b1ad204e85f99198b93a55 100644 --- a/Doc/Sd1/arrays.xml +++ b/Doc/Sd1/arrays.xml @@ -633,12 +633,12 @@ static public long duration(Segment[] route, int personalSpeedLimit) { System.out.println("----+---------"); for (int i = 0; i < markFrequencies.frequencyByMark.length ; i++) { - System.out.println(" " + (markFrequencies.lowestMark + i - 1) + "|" + + System.out.println(" " + (markFrequencies.lowestMark + i) + "|" + markFrequencies.frequencyByMark[i]); } }</programlisting> - <para> providing appropriate unit tests beforehand.</para> + <para>providing appropriate unit tests beforehand.</para> <tip> <orderedlist>