Idea Community Edition mode in Tomcat 7 and publish Web Apps

Source: Internet
Author: User

The idea Community Edition has a lot less functionality than a premium version, including support for Web servers such as Tomcat. Most of the online Idea Web App release tutorials are based on paid editions, and the Community edition doesn't have the tools to run or publish Web apps. Fortunately, it is proven that the MAVEN plugin can be used to achieve the tomcat7-maven-plugin and release of Web applications.

Preparatory work

Check that the following components have been installed and configured:

    • Tomcat7
    • Maven

Tomcat needs to be configured to run as a tomcat user, and if you do not follow the steps to configure Tomcat first:

New User:
sudo useradd tomcat-p Tomcat

To modify the owner of the Tomcat installation directory:

chown -R tomcat:tomcat/opt/apache-tomcat

Modify the user profile for Tomcat:/opt/apache-tomcat/conf/tomcat-users.xml

<tomcat-users>  <rolerolename= "Tomcat"/>  <rolerolename= "Manager"/>  <rolerolename= "Manager-gui"/>  <rolerolename= "Manager-script" />  <rolerolename= "Admin-gui"/>  <Userusername= "Tomcat"Password= "Tomcat"Roles= "Tomcat,manager, Manager-gui,manager-script,admin-gui" /></tomcat-users>

Know that the Manager page will open normally: Http://localhost:8080/manager

Configure the idea so that you can run the tune Web App configuration project run configuration directly in idea

Create a new MAVEN configuration

Edit Run Configuration

Name: From a name

Working directory: Select your project path

Command line: Fill in tomcat7:run (if you are installing TOMCAT7)

Edit the project's Pom.xml file

Add the Tomcat7-maven-plugin plugin to the Pom.xml

<Build>    <pluginmanagement>        <plugin>              <groupId>Org.apache.tomcat.maven</groupId>              <Artifactid>Tomcat7-maven-plugin</Artifactid>              <version>2.2</version>              <Configuration>                <Port>8181</Port>                <Server>Tomcat7</Server>                <Path>/testing</Path>            </Configuration>            </plugin>        </Plugins>    </pluginmanagement>    </Build>

Port: 8181

Path to the Web:/testing

Run the project

Click the green triangle directly or press the shortcut key SHIFT+F10

Enter the address in the browser: http://localhost:8181/testing/

You'll be able to access your Web project.

Publish your web App with maven

Re-edit the project's Pom.xml file

<Build>    <pluginmanagement>        <plugin>              <groupId>Org.apache.tomcat.maven</groupId>              <Artifactid>Tomcat7-maven-plugin</Artifactid>              <version>2.2</version>              <Configuration>                <Port>8181</Port>                <Server>Tomcat7</Server>                <Path>/testing</Path>                <URL>Http://localhost:8080/testing</URL>                <username>Tomcat</username>                <Password>Tomcat</Password>                <Update>True</Update>            </Configuration>            </plugin>        </Plugins>    </pluginmanagement>    </Build>

Increase:

URL: The URL of the Web project you want to publish

Username/password: The username and password here should be the same as the user name password that runs Tomcat

Update: Whether updates

modifying Maven's Settings.xml

When you add a server node:

<Servers>    <Server>       <ID>Tomcat</ID>       <username>Tomcat</username>       <Password>Tomcat</Password>    </Server></Servers>
Publish a web App with the MAVEN command

Go to the root of the project you want to publish, and then execute the following command:

Install Package tomcat7:redeploy-dmaven.test.skip=true

The-dmaven.test.skip=true command is designed to skip unit tests if your project does not need to be skipped and can be removed.

If you get the following information, congratulations, your Web app was published successfully:

Ok! You can find the website you just published in the WebApps directory of Tomcat:Testing.war

Idea Community Edition mode in Tomcat 7 and publish Web Apps

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.