LoginSignup
0
0

More than 5 years have passed since last update.

java, maven メモ

Last updated at Posted at 2019-05-13

what is Maven

プロジェクト管理ツール

install to windows

  1. download maven from https://maven.apache.org/download.cgi
  2. 展開 任意のディレクトリに移動
  3. なんとか/apatch-maven-x.x.x/binをPATHに追加
  4. mvn -v で確認

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>java_training</groupId>
  <artifactId>java_lang</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <properties>
    <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>utf-8</project.reporting.outputEncoding>
    <console.encoding>utf-8</console.encoding>
    <!-- console.encoding>Windows-31J</console.encoding -->
    <maven.compiler.source>12</maven.compiler.source>
    <maven.compiler.target>12</maven.compiler.target>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <compilerArgs>
            <arg>-parameters</arg>
            <arg>--enable-preview</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.1.0</version>
        <configuration>
          <additionalJOption>-J-Dfile.encoding=${console.encoding}</additionalJOption>
          <additionalOptions>--enable-preview</additionalOptions>
          <source>${maven.compiler.source}</source>
          <linksource>true</linksource>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>

build

mvn compile // コンパイル
mvn compile exec:java // exec.mainClassプロパティを設定していれば実行できる
mvn javadoc:javadoc // javadocを生成
mvn clean // 自動生成ファイルを削除
mvn -Dmaven.test.skip=true package // testをskip
mvn -DskipTests package // test を skip
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0