Centosjettygradleng.pdf deploy Javaweb applications in CentOS

Source: Internet
Author: User
By accident, I suddenly thought about it and decided to drop the bbs with my friends on the server. So it took two or three hours to get the result. It's just 20284 m of VPS & amp; it's a little bit difficult, and let's get started. I don't know much about java, but I just need

By accident, I suddenly thought about it and decided to drop the bbs with my friends on the server. So it took two or three hours to get the result.

It seems that the m vps is a little bit difficult. let's start.

I don't know much about java, but I just need to care about gradle and jetty. I finally found that I don't need to care about jetty, but I just need to care about JDK + Gradle.

CentOS JDK

In the first place, I planned to use openJDK, but it seemed that I was not properly configured. so I came to the official website of Oracle, and let's Miss SUN.

Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

After you agree, download the rpm JDK, depending on 64-bit or 32-bit.

Next, we need to set the JAVA_HOME environment variable. (Reprinted and retained Phodal's Blog Phodal's zenthink)

CentOS JDK

rpm -ivh jdk*.rpm

Set environment variables

vim /etc/profile
Check your jdk path and modify it.
JAVA_HOME=/usr/java/jdk1.7.0_45JRE_HOME=/usr/java/jdk1.7.0_45/jrePATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/binCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/libexport JAVA_HOME JRE_HOME PATH CLASSPATH
Application
source /etc/profile
Check whether JAVA_HOME is set and the output environment variable is correct.
echo $PATH

My results are as follows:
/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/java/jdk1.7.0_45/bin:/usr/java/jdk1.7.0_45/jre/bin:/root/bin
Centos Gradle

Gradle is a building system similar to Maven and Ant. it uses Groovy to write build scripts, which can easily perform dependency management and multi-project construction. Gradle integrates Ant's flexibility and power, as well as Maven's dependency management functions and practices. it is a more efficient building tool.

Compared with XML-based build tools such as Maven and Ant, Gradle uses the DSL syntax based on Groovy to write build scripts, making the scripts clear and easy to understand, it also becomes easier to maintain (if you are familiar with the Groovy language ).

Download Gradle

Address: http://www.gradle.org/downloads

After installing this, I jumped over in a simple way.

Unzip gradle *. zip

Link
ln -s PATH/gradle/bin/gradle /bin/gradle
Then

Try gradle

Run

Because nginx encountered a small problem, it seems that no proxy is successful. So we use the iptables modification method to test

Path

/etc/sysconfig/iptables
Vim

Add

-A INPUT -p tcp -m tcp --dport 8976 -j ACCEPT

Then, modify the httpPort on build. gradle to 8976.

sed -i 's/8080/8976/' build.gradle|grep httpPort

Don't forget

service iptables restart 

The last method is ugly, but it can be implemented.

git fetch origingit reset --hard origin/mastersed -i 's/8080/8976/' build.gradle|grep httpPort
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.