On the Redhat Enterprise 6.5 server, Jenkins was used to build a continuous integration environment for the Java Mvaen Project on Gutub. Because the company's servers in the network, access to the external network through the proxy, so for MAVEN plus agents, if your server can directly access the extranet, you can remove the agent.. NET projects can be referenced on Redhat for. NET projects based on Jenkins + Github + Mono Environment of continuous integration
1. Install Maven
wget-e "http_proxy= http://web-proxy.corp.hp.com:8080 " http://mirrors.gigenet.com/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz
su -c "tar -zxvf apache-maven-3.0.5-bin.tar.gz -C /opt/"
su -c "vi /etc/profile.d/maven.sh"
# Add the following lines to maven.sh
export M2_HOME=/opt/apache-maven-3.0.5
export M2=$M2_HOME/bin
PATH=$M2:$PATH
2. 设置代理
如果可以直接连外网,可以路过这步。
如果是公司内网,不设置maven proxy,会报下面的错误:
Waiting for Jenkins to finish collecting Data[error] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of Its dependencies could not being resolved:failed to read artifact descriptor for Org.apache.maven.plugins:maven-resources-p Lugin:jar:2.5:could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to Central (
Http://repo.maven.apache.org/maven2
): Connection to
http://repo.maven.apache.org
Refused:connection timed out--[help 1]
安装完后,用 mvn –version 查看安装信息:
Then go to the MAVEN path:
Cd/opt/apache-maven-3.0.5/conf
To modify the settings:
sudo vi settings.xml
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<port>8080</port>
<nonProxyHosts>127.0.0,1</nonProxyHosts>
</proxy>
3. Jenkins Set Mvaen
Enter System Management:
To build a MAVEN project:
To set the Build property:
When the configuration is complete, click "Build Now" to build successfully:
Build a continuous integration environment based on Jenkins + GitHub for Java MAVEN projects on Redhat