Apache Maven Study notes.
This is a memo that summarizes materials related to Java beginners. The version will be Maven3.
Maven – Welcome to Apache Maven
Apache Maven (Apache Maven / Maven) (At first I thought it was a Marvel-like Marvel of American comics)
Windows
Add settings.xml under C: \ Users \ user \ .m2.
In case of proxy environment Add the following settings to settings.xml.
Proxy setting example
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <proxies>
        <proxy>
            <id>proxy-http</id>
            <active>true</active>
            <protocol>http</protocol>
            <host>proxy.exsample.com</host>
            <port>8080</port>
            <!--<username></username>-->
            <!--<password></password>-->
        </proxy>
        <proxy>
            <id>proxy-https</id>
            <active>true</active>
            <protocol>https</protocol>
            <host>proxy.exsample.com</host>
            <port>8080</port>
            <!--<username></username>-->
            <!--<password></password>-->
        </proxy>
    </proxies>
</settings>
[java --About maven proxy authentication error in internal environment --Stack overflow](https://ja.stackoverflow.com/questions/22073/%E7%A4%BE%E5%86%85%E7%92%B0 % E5% A2% 83% E3% 81% AB% E3% 81% 8A% E3% 81% 91% E3% 82% 8Bmaven% E3% 81% AE% E3% 83% 97% E3% 83% AD% E3 % 82% AD% E3% 82% B7% E8% AA% 8D% E8% A8% BC% E3% 82% A8% E3% 83% A9% E3% 83% BC% E3% 81% AB% E3% 81 % A4% E3% 81% 84% E3% 81% A6)
Application server configuration example such as Tomcat
Deployment destination server setting addition example
    <servers>
        <server>
            <id>localhost</id>
            <username>user</username>
            <password>pass</password>
        </server>
    </servers>
[Windows] [IntelliJ] [Java] [Tomcat] Create an environment for Tomcat9 with IntelliJ --Qiita
Basically, I think you should use maven-archetype-quickstart in ʻorg.apache.maven.archetypes`.
An archtype that includes the main function and JUnit settings.
However, JUnit is as old as 3.8.1, so it may be better to upgrade to 4.x or 5.x.
Maven Repository: junit » junit
Maven execution example
$ mvn archetype:generate \
  -DarchetypeGroupId=org.apache.maven.archetypes \
  -DarchetypeArtifactId=maven-archetype-quickstart \
  -DinteractiveMode=false \
  -DgroupId=${groupId} \
  -DartifactId=${artifactId}
Use maven-compiler-plugin.
pom.xml
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
    </plugins>
  </build>
Apache Maven Compiler Plugin – Introduction Maven Repository: org.apache.maven.plugins » maven-compiler-plugin
How to change Java version for Maven in IntelliJ? - Stack Overflow What to do if Java Compiler is version 1.5 on heroku push and compile error occurs when using lambda expression --Qiita
How to run Java program from Maven --Qiita
Add ʻexec: java` to the command line
If you want to combine externally dependent jars into one jar file, you should use Maven Assembly Plugin.
Collect externally dependent jars with Maven Assembly Plugin --A Memorandum
IntelliJ IDEA Windows Maven execution binary exists around the following, so put it in the PATH here.
C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.1.2\plugins\maven\lib\maven3\bin
Run-time options for multi-module configuration projects · Getting started with Maven3
Maven – Welcome to Apache Maven Maven3 Tutorial
Recommended Posts