标签:描述 启动 dash 浏览器 模型 enabled mvn class atlas
Maven是一个强大的构建工具,一般用于Java项目。Maven项目基于对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的软件项目管理工具。Maven 除了以程序构建能力为特色之外,还提供高级项目管理工具。由于 Maven 的缺省构建规则有较高的可重用性,所以常常用两三行 Maven 构建脚本就可以构建简单的项目。
Maven的Java项目一般需要下载第三方组件,下载后构成本地仓库,为了减少网络对构建项目的影响,一般会构建私服仓库,代理第三方库。Nexus就是构建私服仓库的优秀软件。
图 1 三层仓库架构
Java编译环境包括核心的JDK和编译工具,因为Java的编译工具有很多种,而开源项目作者的随意性很高,常用的工具有maven,gradle,sbt,ant等等,本文关注Maven。
因为Oracle不再维护Java1.7,所以采用Java 1.8作为编译核心.
yum install java-1.8.0-openjdk-devel java-1.8.0-openjdk java-1.8.0-openjdk-headless -y
javac -version
javac 1.8.0_102
java -version
openjdk version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-b14)
OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)
vi ~/.bashrc
增加
export JAVA_HOME=/usr/lib/jvm/java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:$JRE_HOME/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
export _JAVA_OPTIONS="-Xmx2048m -XX:MaxMetaspaceSize=512m -Djava.awt.headless=true"
即刻生效
source ~/.bashrc
vi /etc/sysconfig/network-scripts/ifcfg-ens32
增加天津联通的DNS(如果是其他运行商做相应修改)
DNS1=202.99.96.68
DNS2=202.99.104.68
在实际测试中感觉天津电信的DNS更加靠谱,访问一些特殊网站返回的IP能够顺利访问,大家根据实践选择吧
DNS1=219.150.32.132
DNS2=219.146.0.130
重新启动网络
systemctl restart network
测试
ping www.163.com
PING 163.xdwscache.ourglb0.com (42.81.9.47) 56(84) bytes of data.
64 bytes from 42.81.9.47 (42.81.9.47): icmp_seq=1 ttl=128 time=9.66 ms
64 bytes from 42.81.9.47 (42.81.9.47): icmp_seq=2 ttl=128 time=10.4 ms
…
从官方网站现在最新3.X版
https://www.sonatype.com/download-oss-sonatype
cd /opt/scm
tar -xf ~/download/nexus-3.5.2-01-unix.tar.gz -C .
生成两个目录
nexus-3.5.2-01
sonatype-work
vi /etc/systemd/system/nexus.service
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/scm/nexus-3.5.2-01/bin/nexus start
ExecStop=/opt/scm/nexus-3.5.2-01/bin/nexus stop
User=ansible
Restart=on-abort
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start nexus.service
sudo systemctl status nexus.service
sudo systemctl enable nexus.service
用户名的密码为:admin admin123
设置名称和URL
Cache统一设置为200天 288000
maven-central (安装后自带)
https://repo1.maven.org/maven2/
aliyun
http://maven.aliyun.com/nexus/content/groups/public
central.maven.org
http://central.maven.org/maven2/
oss.sonatype.org
https://oss.sonatype.org/content/repositories/snapshots
apache_snapshot
https://repository.apache.org/content/repositories/snapshots/
apache_release
https://repository.apache.org/content/repositories/releases/
pentaho
https://public.nexus.pentaho.org/content/groups/omni/
atlassian
https://maven.atlassian.com/content/repositories/atlassian-public/
datanucleus
http://www.datanucleus.org/downloads/maven2
How long (in minutes) to cache metadata before rechecking the remote repository.
统一设置为
288000
设置maven-public
将这些代理加入Group
从maven官网下载3.5.0 http://maven.apache.org/download.cgi
cd tools
tar -xf ../download/apache-maven-3.5.0-bin.tar.gz –C .
vi ~/.bashrc
增加
export PATH=/home/ansible/tools/apache-maven-3.5.0/bin:$PATH
即刻生效
source ~/.bashrc
mvn -v
Picked up _JAVA_OPTIONS: -Xmx2048m -XX:MaxMetaspaceSize=512m -Djava.awt.headless=true
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /home/ansible/tools/apache-maven-3.5.0
Java version: 1.8.0_102, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-514.el7.x86_64", arch: "amd64", family: "unix"
vi ~/tools/apache-maven-3.5.0/conf/settings.xml(192.168.154.11是Nexus服务器IP)
<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://192.168.154.11:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
标签:描述 启动 dash 浏览器 模型 enabled mvn class atlas
原文地址:http://www.cnblogs.com/fanzhenyong/p/7709434.html