Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • English_translation
  • main
2 results

Target

Select target project
  • tools-for-programming/week-3
1 result
Select Git revision
  • English_translation
  • main
2 results
Show changes
Commits on Source (4)
......@@ -20,7 +20,7 @@ ArtifactId is the name of the software package compiled from this project.
# Opening the Maven Toolbar
This can be easily done by selecting View->Tool Windows -> Maven. This opens a new view that looks like this:
This can be easily done by selecting (from top left corner) View->Tool Windows -> Maven. This opens a new view that looks like this:
<img src="images/mvn1.png" alt="">
......
......@@ -47,20 +47,20 @@ Maven prints something like this:
```
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< fi.utu.tko2116:MavenExample >----------------------
[INFO] Building MavenEsim 1.0-SNAPSHOT
[INFO] ----------------------< fi.utu:Example >----------------------
[INFO] Building Example 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MavenEsim ---
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.,[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ MavenEsim ---
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Example ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/john/MavenExample/target/classes
[INFO] Compiling 1 source file to /home/john/Example/target/classes
[INFO] ------------------------------------------------------------------------
......@@ -86,15 +86,15 @@ As long as everything is just `INFO`, everything is fine. `WARNING` should be no
[INFO]
[INFO] ----------------------< fi.utu.tko2116:MavenExample >----------------------
[INFO] ----------------------< fi.utu:Example >----------------------
[INFO] Building MavenExample 1.0-SNAPSHOT
[INFO] Building Example 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MavenExample ---
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
......@@ -102,11 +102,11 @@ As long as everything is just `INFO`, everything is fine. `WARNING` should be no
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ MavenExample ---
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Example ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/john/MavenExample/target/classes
[INFO] Compiling 1 source file to /home/john/Example/target/classes
[INFO] -------------------------------------------------------------
......@@ -114,7 +114,7 @@ As long as everything is just `INFO`, everything is fine. `WARNING` should be no
[INFO] -------------------------------------------------------------
[ERROR] /home/john/MavenExample/src/main/java/fi/utu/tko2116/Main.java:[5,43] ';' expected
[ERROR] /home/john/Example/src/main/java/fi/utu/tko2116/Main.java:[5,43] ';' expected
[INFO] 1 error
......@@ -132,9 +132,9 @@ As long as everything is just `INFO`, everything is fine. `WARNING` should be no
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project MavenExample: Compilation failure
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Example: Compilation failure
[ERROR] /home/john/MavenExample/src/main/java/fi/utu/tko2116/Main.java:[5,43] ';' expected
[ERROR] /home/john/Example/src/main/java/fi/utu/tko2116/Main.java:[5,43] ';' expected
[ERROR]
......@@ -142,7 +142,7 @@ As long as everything is just `INFO`, everything is fine. `WARNING` should be no
[ERROR]
[ERROR] To see the full stack trace of the errors, re-[ERROR] /home/john/MavenExample/src/main/java/fi/utu/tko2116/Main.java:[5,43] ';' expectedrun Maven with the -e switch.
[ERROR] To see the full stack trace of the errors, re-[ERROR] /home/john/Example/src/main/java/fi/utu/tko2116/Main.java:[5,43] ';' expectedrun Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
......@@ -158,7 +158,7 @@ Process finished with exit code 1
Finding the Java error from this can be quite tricky, but it can be found in two places:
`[ERROR] /home/john/MavenExample/src/main/java/fi/utu/tko2116/Main.java:[5,43] ';' expected`
`[ERROR] /home/john/Example/src/main/java/fi/utu/tko2116/Main.java:[5,43] ';' expected`
So the error is on line 5 and character 43 on that line: a semicolon is missing.,Still, Java programs can and should be developed using the "play button", but remember that mvn is a command-line tool that also works without IntelliJ. Of course, mvn doesn't compile anything itself, but uses a Java compiler.
......@@ -172,7 +172,7 @@ Of course, again, `jar` packaging is handled by a command-line tool, but we will
You can now execute this package from the command line, with the command
`java -jar MavenExample-1.0-SNAPSHOT.jar` ... or you could, if you had defined that the project has a main method.
`java -jar Example-1.0-SNAPSHOT.jar` ... or you could, if you had defined that the project has a main method.
Maven is often used to create various libraries. In this case, there is no main method, but the program only contains classes intended for others to use. As we are now creating an example application, we need to define a `plugin`, a kind of extension, which ensures that the definition concerning the main method is recorded in the package.
......@@ -194,7 +194,7 @@ This definition can be found in the `plugins/build.xml` file, from this reposito
</project>
```
If you now run `mvn package` again and then `java -jar MavenExample-1.0-SNAPSHOT.jar` the program works.
If you now run `mvn package` again and then `java -jar Example-1.0-SNAPSHOT.jar` the program works.
Next, let's look at the last section, downloading dependencies: [dependencies.md](https://gitlab.utu.fi/TKO_2116/week-3/-/blob/main/dependencies.md).
File moved
File moved
File moved
File moved
File moved
images/compile.png

23 KiB

images/jar.png

15.6 KiB

images/mvn1.png

6.18 KiB

images/mvn2.png

34 KiB

images/projectstart.png

16.2 KiB