2018年12月6日木曜日

CentOS7 mavenインストール

■mavenインストール
CentOS Linux release 7.6.1810
maven-3.6.0
openjdk version "1.8.0_191"

# cd /var/tmp
# curl -OL https://archive.apache.org/dist/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.tar.gz
# tar -xzvf apache-maven-3.6.0-bin.tar.gz
# mv apache-maven-3.6.0 /opt/
# rm /var/tmp/apache-maven-3.6.0-bin.tar.gz
# cd /opt
# ln -s /opt/apache-maven-3.6.0 apache-maven
# vi /etc/profile
export PATH=/opt/apache-maven/bin:$PATH
# source /etc/profile
# mvn -v
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T03:41:47+09:00)
Maven home: /opt/apache-maven
Java version: 1.8.0_191, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre
Default locale: ja_JP, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-957.1.3.el7.x86_64", arch: "amd64", family: "unix"

■JDKインストール
# yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
# dirname $(readlink $(readlink $(which java)))
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/bin
# vi / etc / profile
export JAVA_HOME=/usr/lib/jvm/java
export PATH=$PATH:$JAVA_HOME/bin
# source /etc/profile

■mavenプロジェクト作成と実行
$ mkdir test
$ cd test
$ mvn archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false -DgroupId=com.sample -DartifactId=hello
$ find . -print
.
./hello
./hello/pom.xml
./hello/src
./hello/src/main
./hello/src/main/java
./hello/src/main/java/com
./hello/src/main/java/com/sample
./hello/src/main/java/com/sample/App.java
./hello/src/test
./hello/src/test/java
./hello/src/test/java/com
./hello/src/test/java/com/sample
./hello/src/test/java/com/sample/AppTest.java
$ cd hello
$ mvn compile
$ java -cp target/classes/ com.sample.App
$ mvn test
$ mvn clean













0 件のコメント:

コメントを投稿

シャットダウン時の後処理 (shutdown)

# vi /etc/systemd/system/drop.service [Unit] Description= stop httpgwd DefaultDependencies=no Before=shutdown.target RefuseManualStart=true ...