Commit 6ef83ecb authored by Dr. Martin Goik's avatar Dr. Martin Goik

Purging obsolete Eclipse stuff

parent aaaaed7f
......@@ -45,226 +45,6 @@
</mediaobject>
</figure>
<section xml:id="sect_mavenConfigEclipseProject">
<title>Create a Maven based project in Eclipse</title>
<para>The following section requires the eclipse Maven plugin to be
installed. This may be accomplished by installing the <productname
xlink:href="https://www.jboss.org/tools">Jboss Tools</productname> via
<guimenu>Help</guimenu> <guisubmenu>Eclipse Marketplace</guisubmenu>
which will install Maven as a dependency.</para>
<orderedlist>
<listitem>
<para>We start Eclipse and choose the <quote>new project</quote>
wizard.</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="Ref/Screen/CreateMaven/1.png" scale="80"/>
</imageobject>
</mediaobject>
</informalfigure>
</listitem>
<listitem>
<para>Filtering <quote>maven</quote> yields our desired project
type</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="Ref/Screen/CreateMaven/2.png" scale="80"/>
</imageobject>
</mediaobject>
</informalfigure>
</listitem>
<listitem>
<para>Just accept the defaults</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="Ref/Screen/CreateMaven/3.png" scale="80"/>
</imageobject>
</mediaobject>
</informalfigure>
</listitem>
<listitem>
<para>We select <quote>maven-archetype-quickstart</quote> to choose
a plain <xref linkend="glo_Java"/> project</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="Ref/Screen/CreateMaven/4.png" scale="80"/>
</imageobject>
</mediaobject>
</informalfigure>
</listitem>
<listitem>
<para>The chosen Group Id will become our project's name.</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="Ref/Screen/CreateMaven/5.png" scale="80"/>
</imageobject>
</mediaobject>
</informalfigure>
</listitem>
<listitem>
<para>We end up with a <xref linkend="glo_Java"/> project already
being enabled for <productname
xlink:href="http://www.junit.org">Junit</productname>
testing.</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="Ref/Screen/CreateMaven/6.png" scale="80"/>
</imageobject>
</mediaobject>
</informalfigure>
</listitem>
</orderedlist>
<para> But wait: We are about to work with (<xref
linkend="glo_Soft_Mysql"/>) databases. Thus we need at least a
<trademark
xlink:href="http://www.oracle.com/technetwork/java/javase/jdbc">JDBC</trademark>
driver. Maven assists us if we define an appropriate dependency as we
will see in the following section.</para>
</section>
<section xml:id="sect_mavenAddMysqlJdbcConnector">
<title>Adding a <xref linkend="glo_Soft_Mysql"/> <xref
linkend="glo_JDBC"/> driver</title>
<para>We might just download a <xref linkend="glo_JDBC"/> implementation
<xref linkend="glo_Jar"/> file like
<filename>mysql-connector-java-5.1.16.jar</filename> manually and add it
to our (Eclipse) environment. If we want to share our project with other
people or work on it on different workstations this jar file must be
available on each system we are working with.</para>
<para>One solution might be to integrate it into our project completely
(e.g. in a <filename>lib</filename> folder) and put the whole project
under version control (<xref linkend="glo_Soft_Git"/>, <xref
linkend="glo_Svn"/>). On the other hand this just bloats our project
with external (library) dependencies.</para>
<para>Maven helps us to easily manage external dependencies. The idea is
to keep them in centralized repositories for download and add meta
information like a package name, a package group name and a version
number for retrieval:</para>
<orderedlist>
<listitem>
<para>Searching for <quote>mysql</quote> in a maven repository
yields the <xref linkend="glo_Java"/> <trademark
xlink:href="http://www.oracle.com/technetwork/java/javase/jdbc">JDBC</trademark>
connector:</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="Ref/Screen/CreateMaven/mysql1.png"
scale="80"/>
</imageobject>
</mediaobject>
</informalfigure>
</listitem>
<listitem>
<para>We choose the most recent version:</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="Ref/Screen/CreateMaven/mysql2.png"
scale="80"/>
</imageobject>
</mediaobject>
</informalfigure>
</listitem>
<listitem>
<para>Again we copy the dependency snippet ...</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="Ref/Screen/CreateMaven/mysql3.png"
scale="80"/>
</imageobject>
</mediaobject>
</informalfigure>
</listitem>
<listitem>
<para>... and add it to our <filename>pom.xml</filename> file's
dependency section:</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="Ref/Screen/CreateMaven/mysql4.png"
scale="80"/>
</imageobject>
</mediaobject>
</informalfigure>
</listitem>
<listitem>
<para>Did we actually succeed? Right-clicking on our project
<guimenu>Build path</guimenu> <guisubmenu>Configure Build
Path</guisubmenu> and choosing the
<guisubmenu>Libraries</guisubmenu> tab we see our
<envar>CLASSPATH</envar> being extended:</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="Ref/Screen/CreateMaven/mysql5.png"
scale="80"/>
</imageobject>
</mediaobject>
</informalfigure>
<para>Notice the location of the <productname
xlink:href="https://www.mysql.com">Mysql</productname> jar below the
<filename>.m2</filename> Maven folder in the user's home directory.
If we share our project this location will change to e.g.
<filename>c:\users\foo\.m2\...</filename> due to different system
default paths.</para>
</listitem>
</orderedlist>
</section>
<section xml:id="sect_mavenAddHibernate">
<title>Adding Hibernate dependencies</title>
<para>Our goal is to start using Hibernate for a console based project.
Searching the Maven repository for <code>hibernate-entitymanager</code>
provides a suitable artifact:</para>
<programlisting language="xml">&lt;dependency&gt;
&lt;groupId&gt;org.hibernate&lt;/groupId&gt;
&lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
&lt;version&gt;5.1.0.Final&lt;/version&gt;
&lt;/dependency&gt;</programlisting>
<para>The MI department provides a dedicated
<quote>mi-maven-archetype-jpa-hibernate</quote>. See <xref
linkend="sd1_sect_idea"/> for archetype repository configuration.</para>
</section>
<section xml:id="sect_createHibernateConfiguration">
<title>Creating a <xref linkend="glo_JPA"/> configuration</title>
......
<?xml version="1.0" encoding="UTF-8"?>
<book version="5.1" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:db="http://docbook.org/ns/docbook">
<info>
<title>Structured data and applications 2</title>
<author>
<personname><firstname>Martin</firstname>
<surname>Goik</surname></personname>
<affiliation>
<orgname>http://medieninformatik.hdm-stuttgart.de</orgname>
</affiliation>
</author>
<legalnotice>
<para>Source code available at <uri
xlink:href="https://gitlab.mi.hdm-stuttgart.de/goik/GoikLectures.git">https://gitlab.mi.hdm-stuttgart.de/goik/GoikLectures.git</uri></para>
</legalnotice>
</info>
</book>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment