Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
cities.list.json.gz
providing cities
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
-1.34 0.34 + sqrtLecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
(#1 of 3) |
Lecture notes |
Pdf slides |
|
(#2 of 3) |
Lecture notes |
Pdf slides |
|
(#3 of 3) |
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
(#1 of 13) |
Lecture notes |
Pdf slides |
|
(#2 of 13) |
Lecture notes |
Pdf slides |
|
(#3 of 13) |
Lecture notes |
Pdf slides |
|
(#4 of 13) |
Lecture notes |
Pdf slides |
|
(#5 of 13) |
Lecture notes |
Pdf slides |
|
(#6 of 13) |
Lecture notes |
Pdf slides |
|
(#7 of 13) |
Lecture notes |
Pdf slides |
|
(#8 of 13) |
Lecture notes |
Pdf slides |
|
(#9 of 13) |
Lecture notes |
Pdf slides |
|
(#10 of 13) |
Lecture notes |
Pdf slides |
|
(#11 of 13) |
Lecture notes |
Pdf slides |
|
(#12 of 13) |
Lecture notes |
Pdf slides |
|
(#13 of 13) |
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
(#1 of 11) |
Lecture notes |
Pdf slides |
|
(#2 of 11) |
Lecture notes |
Pdf slides |
|
(#3 of 11) |
Lecture notes |
Pdf slides |
|
(#4 of 11) |
Lecture notes |
Pdf slides |
|
(#5 of 11) |
Lecture notes |
Pdf slides |
|
(#6 of 11) |
Lecture notes |
Pdf slides |
|
(#7 of 11) |
Lecture notes |
Pdf slides |
|
(#8 of 11) |
Lecture notes |
Pdf slides |
|
(#9 of 11) |
Lecture notes |
Pdf slides |
|
(#10 of 11) |
Lecture notes |
Pdf slides |
|
(#11 of 11) |
Lecture notes |
Pdf slides |
|
(#1 of 14) |
Lecture notes |
Pdf slides |
|
(#2 of 14) |
Lecture notes |
Pdf slides |
|
(#3 of 14) |
Lecture notes |
Pdf slides |
|
(#4 of 14) |
Lecture notes |
Pdf slides |
|
(#5 of 14) |
Lecture notes |
Pdf slides |
|
(#6 of 14) |
Lecture notes |
Pdf slides |
|
(#7 of 14) |
Lecture notes |
Pdf slides |
|
(#8 of 14) |
Lecture notes |
Pdf slides |
|
(#9 of 14) |
Lecture notes |
Pdf slides |
|
(#10 of 14) |
Lecture notes |
Pdf slides |
|
(#11 of 14) |
Lecture notes |
Pdf slides |
|
(#12 of 14) |
Lecture notes |
Pdf slides |
|
(#13 of 14) |
Lecture notes |
Pdf slides |
|
(#14 of 14) |
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
(#1 of 10) |
Lecture notes |
Pdf slides |
|
(#2 of 10) |
Lecture notes |
Pdf slides |
|
(#3 of 10) |
Lecture notes |
Pdf slides |
|
(#4 of 10) |
Lecture notes |
Pdf slides |
|
(#5 of 10) |
Lecture notes |
Pdf slides |
|
(#6 of 10) |
Lecture notes |
Pdf slides |
|
(#7 of 10) |
Lecture notes |
Pdf slides |
|
(#8 of 10) |
Lecture notes |
Pdf slides |
|
(#9 of 10) |
Lecture notes |
Pdf slides |
|
(#10 of 10) |
Lecture notes |
Pdf slides |
|
Readme.mdLecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Math.class and
Print.class.
Lecture notes |
Pdf slides |
|
Math.class,
Print.class and versioning.
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Print.java manually
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
(#1 of 8) |
Lecture notes |
Pdf slides |
|
(#2 of 8) |
Lecture notes |
Pdf slides |
|
(#3 of 8) |
Lecture notes |
Pdf slides |
|
(#4 of 8) |
Lecture notes |
Pdf slides |
|
(#5 of 8) |
Lecture notes |
Pdf slides |
|
(#6 of 8) |
Lecture notes |
Pdf slides |
|
(#7 of 8) |
Lecture notes |
Pdf slides |
|
(#8 of 8) |
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
(#1 of 4) |
Lecture notes |
Pdf slides |
|
(#2 of 4) |
Lecture notes |
Pdf slides |
|
(#3 of 4) |
Lecture notes |
Pdf slides |
|
(#4 of 4) |
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
~/.m2/settings.xmlLecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
maven-javadoc-pluginLecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
pom.xmlLecture notes |
Pdf slides |
|
~/.m2/repository/junit/junit/4.12/junit-4.12.pomLecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
(#1 of 6) |
Lecture notes |
Pdf slides |
|
(#2 of 6) |
Lecture notes |
Pdf slides |
|
(#3 of 6) |
Lecture notes |
Pdf slides |
|
(#4 of 6) |
Lecture notes |
Pdf slides |
|
(#5 of 6) |
Lecture notes |
Pdf slides |
|
(#6 of 6) |
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
(#1 of 7) |
Lecture notes |
Pdf slides |
|
(#2 of 7) |
Lecture notes |
Pdf slides |
|
(#3 of 7) |
Lecture notes |
Pdf slides |
|
(#4 of 7) |
Lecture notes |
Pdf slides |
|
(#5 of 7) |
Lecture notes |
Pdf slides |
|
(#6 of 7) |
Lecture notes |
Pdf slides |
|
(#7 of 7) |
Lecture notes |
Pdf slides |
|
Lecture notes |
Pdf slides |
|
![]() |
Is this your TEAM? Toll Ein Anderer Machts |
You are expected to work as a team of three partners.
Using the MI Gitlab SCM is a plus with respect to project evaluation. See table below.
Your team is expected to supply a Maven project based on the
MI “Maven archetype quickstart” available from https://maven.mi.hdm-stuttgart.de/nexus/repository/mi-maven/archetype-catalog.xml.
You are expected to provide good internal code documentation with respect both to method signatures (Javadoc™) and method implementation.
You are expected to provide good internal code documentation with respect both to method signatures (Javadoc™) and method implementation. Possible problems involve:

Activate most compiler warnings at Editor → Inspections. This will show potential compile time problems like dead / unnecessary / unreachable code, unused variable values, shadowing conflicts and so on.
Your method's formal parameters, their type and a method's return type must match your documentation.

You are expected to provide meaningful unit tests:
Try to cover all your implementation code and not just isolated modules / methods.
If methods allow for null values write suitable tests.
Test special cases: If a method expects i.e. an array of strings it may be allowed having zero length.
Your resulting project should be easily installable and runnable.
Maven is a good starting point with respect both to testing and cross platform (Unix / Windows / Apple) portability.
Avoid dependencies to local file system resources like
c:\users\xyz\testdata.txt.
Test your application's deployability by installing it on an
untouched target platform (possibly of a different hard/software
architecture) and execute mvn test
(provided you do have written meaningful unit tests).
| Criterion | Percentage |
|---|---|
| Overall code quality | 20% |
| Code documentation | 20% |
| Unit tests | 10% |
| Deployment | 10% |
| SCM usage | 10% |
| Software functionality | 30% |
goik@goiki target> java -jar weather-1.0.jar Stuttgart ❶ 1 = Stadtkreis Stuttgart ❷ 2 = Regierungsbezirk Stuttgart 3 = Stuttgart 4 = Stuttgart Feuerbach 5 = Stuttgart Muehlhausen Bitte gültige Auswahl 1 bis 5 treffen:2 ❸ Vorhersage für Regierungsbezirk Stuttgart ❹ Dienstag, 15.05 23:00: 11°C, Leichter Regen Mittwoch, 16.05 02:00: 10°C, Leichter Regen 05:00: 10°C, Leichter Regen 08:00: 11°C, Leichter Regen ...
https://api.openweathermap.org/data/2.5/forecast?lang=de& ❶ APPID=7cufdhdcgdhsgdhgfcgsdss67b3&units=metric&id=3214105 {"cod":"200","message":0.0042,"cnt":40,"list":[ ❷ {"dt":1526428800,"main":{"temp":10.29,"temp_min":10.29, "temp_max":12.45,"pressure":985.75,"sea_level":1027.48, "grnd_level":985.75,"humidity":80,"temp_kf":-2.16}, "weather":[{"id":500,"main":"Rain", "description":"Leichter Regen","icon":"10n"}],"clouds": {"all":88},"wind":{"speed":1.59,"deg":313.503},"rain": {"3h":0.315},"sys":{"pod":"n"},"dt_txt":"2018-05-16 00:00:00"}, {"dt":1526439600,"main": ...
|
An URL containing an id value corresponding to a uniquely defined town or region. We identify the following components:
|
|
|
|
[
{
"id": 2886241,
"name": "Regierungsbezirk Köln",
"country": "DE",
"coord": {
"lon": 7.16667,
"lat": 50.833328
}
},
{
"id": 3247452,
"name": "Kreis Euskirchen",
...
]FileUtils.copyURLToFile( "https://api.openweathermap.org/data/2.5/forecast...", new File("weatherData.json"));
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>public class Cities { static public final City[] cities; ... }
@Test public void testParsedCityCount() { Assertions.assertEquals(209579, Cities.cities.length); }
public class WeatherDataParser { static public final Weather parse(final String jsonWeatherDataFilename) throws IOException { return ...; } }
@Test public void testParseWeatherData() { ... Weather weather = WeatherDataParser.parse( "src/main/resources/stuttgart.weather.json"); ...
The application shall accept a command line parameter like
e.g. «Stuttgart» to filter matching cities from cities.list.json.
If a given filter matches multiple locations the user shall have an option for choosing the desired one.
The most recent city id value shall be cached in a file. Subsequent invocations without command line parameter shall provide a current forecast corresponding to this value.
Weather data belonging to a given id value shall be cached
locally for 10 minutes. Subsequent weather queries within this
period shall be read from cache rather than by accessing
https://api.openweathermap.org/... .
Provide logging to a file rather than to the console to avoid cluttering the user interface. Log cache handling.
Provide logging to a file rather than to the console to avoid cluttering the user interface.
Log cache handling.
main INFO weather.Forecast - Re-using cache file '/ma/goik/Forecast/6930414.json' from 196 seconds ago
final String[] patterns = new String[] {
"sqrt",
"[-]?([0-9]+[.]?[0-9]*|[.][0-9]+)(E[-]?[0-9]+)?",// Matches e.g. -1.5E-33
"\\+"};// Escape required avoiding regular expression syntax clash.
final String expression = "2.1 -3.4 sqrt";
try (final Scanner scanner = new Scanner(expression)) {
while (scanner.hasNext()) {
for (final String p: patterns) {
if (scanner.hasNext(p)) {
IO.println("Token '" + scanner.next(p) +
"' matched by '" + p + "'");
break;
}
}
}
}Token '2.1' matched by '[-]?([0-9]+[.]?[0-9]*|[.][0-9]+)(E[-]?[0-9]+)?' Token '-3.4' matched by '[-]?([0-9]+[.]?[0-9]*|[.][0-9]+)(E[-]?[0-9]+)?' Token 'sqrt' matched by 'sqrt'
...
final String[] patterns = new String[] {
"sqrt",
"[-]?([0-9]+[.]?[0-9]*|[.][0-9]+)(E[-]?[0-9]+)?",// Matches e.g. -1.5E-33
"\\+"};// Escape required avoiding regular expression syntax clash.
try (final Scanner scanner = new Scanner("2.1 -3.4 pbck") ❶) {
while (scanner.hasNext()) {
boolean foundToken = false;
for (final String p: patterns) {
if (scanner.hasNext(p)) {
foundToken = true;
IO.println("Token '" + scanner.next(p) +
"' matched by '" + p + "'");
break;
}
}
if (!foundToken) {
IO.println("Parsing error at '" + scanner.nextLine() + "'");
System.exit(1);
} ...Token '2.1' matched by '[-]?([0-9]+[.]?[0-9]*|[.][0-9]+)(E[-]?[0-9]+)?'
Token '-3.4' matched by '[-]?([0-9]+[.]?[0-9]*|[.][0-9]+)(E[-]?[0-9]+)?'
Parsing error at 'pbck'The following installations allow for exercises with respect to the final examination:
E-Exam 113105 Softwareentwicklung 1 Test / Network blocked:
The examination environment with firewall rules restricting Internet access to a small number of allowed sites.
E-Exam 113105 Softwareentwicklung 1 Test / Teamviewer:
No Internet blocking. Teamviewer allows for getting external help.
The debugger is your friend ...
... but only if acquiring prior proficiency.
Train prime or related example.
Task definitions by Javadoc™.
Corresponding Unit tests.
Automated evaluation scoring your achievements.
Individual weights reflecting a test's significance.
/**
* Finde das n-te ungerade Element einer Wertefolge.
*
* <p>Beispiel: Im Array {3, 2, 0, 1, 4} ist der Wert «1» an der Index-
* position «3» das zweite ungerade Element.</p>
*
* @param werte Die zu durchsuchenden Werte.
* @param n Die gewünschte Position, Start bei 1.
*
* @return Den Index des n-ten ungeraden Wertes falls es mindestens n
* ungerade Werte gibt, ...
*/
static public int getNtesUngeradesElement(final int[] werte, final int n){
return 12345; // TODO: Implementiere mich korrekt!
}@Test
@Points(2) /* 2 points if test passes */
public void test_400() {
Assertions.assertEquals(
2, /* Expected result */
Helper.getNtesUngeradesElement(new int[]{-4, 6, 1, -2, 8}, 1));
}| Unit Tests | Your solution |
|---|---|
assertFalse(isPrime(1)); assertTrue (isPrime(2)); assertTrue (isPrime(3)); assertFalse(isPrime(4)); assertTrue (isPrime(5)); assertFalse(isPrime(6)); assertTrue (isPrime(7)); assertFalse(isPrime(8)); assertFalse(isPrime(9)); assertFalse(isPrime(10)); |
... boolean isPrime(final int p) {
switch (p) {
case 2:
case 3:
case 5:
case 7:
return true;
default:
return false; } |
Will be treated as an attempt at deception / Täuschungsversuch.
Unit testing is relentless: You are no longer at high school where a result having “just” a wrong sign used to matter next to nothing.
Focus on completing units of work rather than “nearly” finishing a large number of tasks.
Watching a test fail just happens. Learn to systematically fix bugs:
equals() and
hashCode()StringBuffer
Instanzenequals(...) und hashCode()Creating an empty new project itself.
Adding fellow project users for participation.
>git clone git@gitlab.mi.hdm-stuttgart.de:goik/vcintro.git
Cloning into 'vcintro'...
warning: You appear to have cloned an empty repository.>cd vcintro/ >vim Readme.md >git add Readme.md |
# Initial project description. Will be extended when adding more assets. |
EDITOR=vim git commit Readme.md |
Adding Readme file in Markdown format
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
#
# Initial commit
#
# Changes to be committed:
# new file: Readme.md |
>git push
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 306 bytes | 306.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To gitlab.mi.hdm-stuttgart.de:goik/vcintro.git
* [new branch] master -> master>mvn --batch-mode -e archetype:generate -Dversion=0.9 \ > -DgroupId=de.hdm_stuttgart.mi.sd1 \ > -DartifactId=first -DarchetypeGroupId=de.hdm_stuttgart.mi \ > -DarchetypeArtifactId=mi-maven-archetype-quickstart -DarchetypeVersion=1.2.1
>find first/ -type f first/.gitignore first/src/test/java/de/hdm_stuttgart/mi/sd1/AppTest.java first/src/main/java/de/hdm_stuttgart/mi/sd1/App.java first/src/main/resources/log4j2.xml first/pom.xml
> git status On branch master Your branch is up to date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) first/ nothing added to commit but untracked files present (use "git add" to track)
>git add `find first/ -type f`
>git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: first/.gitignore
new file: first/pom.xml
new file: first/src/main/java/de/hdm_stuttgart/mi/sd1/App.java
new file: first/src/main/resources/log4j2.xml
new file: first/src/test/java/de/hdm_stuttgart/mi/sd1/AppTest.java>git status On branch master Your branch is up to date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: first/.gitignore new file: first/pom.xml new file: first/src/main/java/de/hdm_stuttgart/mi/sd1/App.java new file: first/src/main/resources/log4j2.xml new file: first/src/test/java/de/hdm_stuttgart/mi/sd1/AppTest.java
EDITOR=vim git commit -a |
Adding a Maven project.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up to date with 'origin/master'.
#
# Changes to be committed:
# new file: first/.gitignore
# new file: first/pom.xml
# new file: first/src/main/java/de/hdm_stuttgart/mi/sd1/App.java
# new file: first/src/main/resources/log4j2.xml
# new file: first/src/test/java/de/hdm_stuttgart/mi/sd1/AppTest.java
|
>git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean>git push
Counting objects: 22, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (22/22), 3.31 KiB | 1.10 MiB/s, done.
Total 22 (delta 0), reused 0 (delta 0)
To gitlab.mi.hdm-stuttgart.de:goik/vcintro.git
32da2ff..4e19142 master -> master>git status ... Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: Readme.md
git checkout -- Readme.md
>git status Your branch is up to date with 'origin/master'. nothing to commit, working tree clean
>git pull remote: Enumerating objects: 10, done. remote: Counting objects: 100% (10/10), done. remote: Compressing objects: 100% (6/6), done. remote: Total 6 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (6/6), done. From gitlab.mi.hdm-stuttgart.de:goik/vcintro 3751344..83bd7b9 master -> origin/master Updating 3751344..83bd7b9 Fast-forward Readme.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Git:
A completely ignorant, childish person with no manners.
A person who feels justified in their callow behaviour.
A pubescent kid who thinks it's totally cool to act like a moron on the Internet, only because no one can actually reach through the screen and punch their lights out.
Creating a git project
Important commands: git add, git commit, git log, ...
git status On branch master ❶ No commits yet ❷ Untracked files: ❸ (use "git add <file>..." to include in what will be committed) Math.java nothing added to commit but untracked files present (use "git add" to track) ❹
|
public class Math {
/**
* Summing two int values.
* @param a first value.
* @param b second value.
* @return The sum of both.
*/
static public int add(
final int a, final int b) {
return a + b;
}
} |
> javac Print.java Math.java # Compilation creating Math.class and Print.class
> git status
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
Math.class
Print.class
nothing added to commit but untracked files present (use "git add" to track)Math.class and
Print.class are being generated from
Math.java and
Print.java.
Rule of thumb: Do not version dependent objects.
Solution: Add a .gitignore file to
versioning to contain:
# ignore generated .class files *.class
git log commit 0137ccd857a242f4751e36bdbce365c6130c3a32 ❶(HEAD -> master) Author: Martin Goik <goik@hdm-stuttgart.de> Date: Sat May 25 11:56:00 2019 +0200 Removing duplicate headline ❷ commit 7f119fac36e02e4c5a7f04f022217b6f744d6e1d ❸ Author: Martin Goik <goik@hdm-stuttgart.de> Date: Sat May 25 11:49:52 2019 +0200 Project Readme.md ❹ ...
git checkout 7f119fac36e02e4c5a7f04f022217b6f744d6e1d Note: checking out '7f119fac36e02e4c5a7f04f022217b6f744d6e1d'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b <new-branch-name> HEAD is now at 7f119fa Project Readme.md
git checkout master Previous HEAD position was 7f119fa Project Readme.md Switched to branch 'master'
Connecting local to remote repository or clone
push local to remote
pull from remote to local
Create empty remote
repository on gitlab.mi.hdm-stuttgart.de.
Connect local repository to remote


git remote add origin ❶ https://gitlab.mi.hdm-stuttgart.de/goik/gitintro.git
|
origin is an alias for our
remote repository
|
git push --set-upstream origin ❶ master Username for 'https://gitlab.mi.hdm-stuttgart.de': goik ❷ Password for 'https://goik@gitlab.mi.hdm-stuttgart.de': Counting objects: 5, done. Delta compression using up to 6 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (5/5), 507 bytes | 507.00 KiB/s, done. Total 5 (delta 0), reused 0 (delta 0) To https://gitlab.mi.hdm-stuttgart.de/goik/gitintro.git * [new branch] master -> master ❸ Branch 'master' set up to track remote branch 'master' from 'origin'.
> git pull ❶ Username for 'https://gitlab.mi.hdm-stuttgart.de': goik ❷ Password for 'https://goik@gitlab.mi.hdm-stuttgart.de': remote: Enumerating objects: 8, done. remote: Counting objects: 100% (8/8), done. remote: Compressing objects: 100% (6/6), done. remote: Total 6 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (6/6), done. From https://gitlab.mi.hdm-stuttgart.de/goik/gitintro ❸ 733e541..ffff092 master -> origin/master Updating 733e541..ffff092 ❹ Fast-forward Math.java | 10 ++++++++-- ❺ 1 file changed, 8 insertions(+), 2 deletions(-)
Create new possibly non-empty project at https://gitlab.mi.hdm-stuttgart.de.
> git clone https://gitlab.mi.hdm-stuttgart.de/goik/gitintro.git Cloning into 'gitintro'... Username for 'https://gitlab.mi.hdm-stuttgart.de': goik Password for 'https://goik@gitlab.mi.hdm-stuttgart.de': remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (4/4), done. remote: Total 5 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (5/5), done.
Line level conflicts
Manual merge
| User A: Print.java | User B: Print.java |
|---|---|
// Driver class
public class Print {
static void main() {
IO.println
(Math.add(2, 3));
}
} |
/**
* Application entry point
*/
public class Print {
static void main() {
IO.println
(Math.add(2, 3));
}
} |
| User A | User B |
|---|---|
| Edit: ... Driver class ... | - |
| git commit, git push | - |
| - | edit: ... Application entry point ... |
| - | git commit |
| - | git push: Fail! |
>git push ... To https://gitlab.mi.hdm-stuttgart.de/goik/gitintro.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://gitlab.mi.hdm-stuttgart.de/goik/gitintro.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again.
>git pull ... From https://gitlab.mi.hdm-stuttgart.de/goik/gitintro b003a82..dbbedb0 master -> origin/master Auto-merging Print.java CONFLICT (content): Merge conflict in Print.java Automatic merge failed; fix conflicts and then commit the result.
>git diff Print.java diff --cc Print.java index fc36ae6,7b27edf..0000000 --- a/Print.java +++ b/Print.java @@@ -1,6 -1,4 +1,10 @@@ ++<<<<<<< HEAD +/** ❶ + * Application entry point + */ ++======= + // Driver class ❷ ++>>>>>>> dbbedb0fc29d77beeaaada37f2538d78f82bac93 public class Print { static void main() { IO.println (Math.add(2, 3)); } }

<<<<<<< HEAD /** * Application entry point */ ======= // Driver class >>>>>>> 10cf21c ... 759462c public class Print { static void main() { IO.println (Math.add(2, 3)); } } |
➱ | /** * Driver class, application entry point */ public class Print { static void main() { IO.println (Math.add(2, 3)); } } |
>git add Print.java >git commit --message "Merging changes" [master 173487a] Merging changes >git push ... To https://gitlab.mi.hdm-stuttgart.de/goik/gitintro.git 10cf21c..173487a master -> master
Build tool
Project management tool
Create reports
Continuous integration support
Build tool
Dependency management
Repository system
Plugin framework
Sensible default values:
Source below ${basedir}/src/main/java
Tests below ${basedir}/src/test
Bytecode, jar/war archives below
${basedir}/target
...
<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>
...
</project>Declarative project description
Dependencies
Builds
Artifacts
No explicit instructions
|
|
pom.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>mkdir -p src/main/java ❶ vim src/main/java/Hello.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.
>mvn help:effective-pom <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
<encoding implementation="java.lang.String" default-value="${project.build.sourceEncoding}">${encoding}</encoding>
<source implementation="java.lang.String" default-value="1.5">${maven.compiler.source}</source>
<target implementation="java.lang.String" default-value="1.5">${maven.compiler.target}</target><project ... xsd/maven-4.0.0.xsd">
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties> ...rm -rf ~/.m2/repository/
mvn compile; find ~/.m2/repository/ -type f|wc -l
220jar -tf /usr/share/apache-maven-3.0.5/lib/maven-model-builder-3.0.5.jar ... org/apache/maven/model/plugin/ReportingConverter.class org/apache/maven/model/pom-4.0.0.xml org/apache/maven/model/profile/activation/FileProfileActivator$1.class ...
... <!-- Does this ring a (security related) bell? --> <repositories> <repository> <id>central</id> <name>Central Repository</name> <url>http://repo.maven.apache.org/maven2</url> ... <pluginRepositories> <pluginRepository> <id>central</id> <name>Central Repository</name> <url>http://repo.maven.apache.org/maven2</url> ...
<settings ... settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>central-secure</id>
<mirrorOf>central</mirrorOf>
<name>Maven Central: Favour https over http.</name>
<url>https://repo.maven.apache.org/maven2</url>
</mirror>
</mirrors>
...first> mvn help:effective-pom
... Effective POMs, after inheritance, interpolation, and profiles are applied:
<project xmlns="http://maven.apache.org/POM/4.0.0" ...>
<modelVersion>4.0.0</modelVersion>
...
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<executions>
<execution>
<id>default-jar</id>
...Tiny core
Plugin extensible
Hint: mvn help:effective-pom
lists included plugins.
Testing: maven-surefire-plugin
Library dependencies:
maven-dependency-plugin
Packaging: maven-jar-plugin
Documentation: maven-javadoc-plugin
first> jar -tf ~/.m2/repository/org/apache/maven/plugins/\
maven-javadoc-plugin/3.0.0/maven-javadoc-plugin-3.0.0.jar
...
META-INF/LICENSE
META-INF/maven/org.apache.maven.plugins/maven-javadoc-plugin/plugin-help.xml
javadoc-report.properties
META-INF/maven/plugin.xml
log4j.properties
META-INF/NOTICE
org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo$JavaEntityTags.class
org/apache/maven/plugins/javadoc/AggregatorTestJavadocReport.class
...<project ... maven-4.0.0.xsd"> ...
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>... |
import org.junit.Test; import org.junit.Assert; public class AppTest { @Test public void doTest() { Assert.assertEquals(1, 1); } |
first> mvn test [INFO] Scanning for projects... Running de.hdm_stuttgart.mi.sd1.AppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.053 sec |
|
first> mvn dependency:tree ... [INFO] de.hdm_stuttgart.mi.sd1:first:jar:0.9 [INFO] \- junit:junit:jar:4.12:test [INFO] \- org.hamcrest:hamcrest-core:jar:1.3:test
~/.m2/repository/junit/junit/4.12/junit-4.12.jar
~/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
<project ... maven-4.0.0.xsd">
...
<!-- no such entry -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
...<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
</dependency>
</dependencies><project ... maven-4.0.0.xsd"> ...
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>... |
import org.testng.annotations.Test; import org.testng.Assert; public class AppTest { @Test public void doTest() { Assert.assertEquals(1, 1); } |
testng> mvn test
Running de.hdm_stuttgart.mi.sd1.AppTest
Configuring TestNG with: org.apache.maven.surefire...
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.372 sec |
|
clean, compile, test, package, deploy, ...
Sequence of named phases
clean
(Lifecycle)pre-clean
clean (Phase)
post-clean
See Default Lifecycle.
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<outputDirectory>${project.build.directory}/metamodel</outputDirectory>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
...