MyEclipse using the Summary--maven project how to start a run publish to Tomcat [go]

Source: Internet
Author: User

Two previous articles:

Create a new MAVEN Framework Web project

And

Change original project to MAVEN framework

After that, we've got Maven's project.

So

How did the MAVEN project start?

If we press the previous startup method directly in the MyEclipse, it is not possible. (More on the next article: Start the MAVEN project in MyEclipse)

However, the MAVEN project can generate a local war package to manually move to Tomcat, or it can be automatically published to local, remote Tomcat.

So we're going to try both of these ways:

Generate a war package, run it manually

Right-click on the project, run as-----> Maven Install will generate the war package locally

Find the relevant directory:

Copy this package to the WebApp path of our natively installed Tomcat:

Start Tomcat:

After the start, one thing to note:

The access page is the same path as the published project, even if the web directory is set to Ipfilterm

But here to use:

Ipfilterm-0.0.1-snapshot

otherwise 404

Problems you may encounter:

The MAVEN-generated war package ran an error under Tomcat

Automatically publish to local, remote tomcat

Modify the next Tomcat configuration file first

Tomcat-users.xml in the---installation directory

Tomcat7.0\conf\tomcat-users.xml

[Java]View Plaincopy
    1. <tomcat-users>
    2. <role rolename="Manager-gui"/>
    3. <role rolename="manager"/>
    4. <role rolename="Manager-script"/>
    5. <user username="Tomcat" password="Tomcat" roles="Manager-gui,manager,manager-script"/>
    6. </tomcat-users>

If you already have the relevant user information, you do not have to add, but the permissions should be added

<role rolename= "Manager-gui"/>
<role rolename= "Manager"/>
<role rolename= "Manager-script"/>

Manager-gui,manager,manager-script

After the Tomcat configuration is successful, it can be Localhost:8080\manager

The Tomcat admin interface is logged in as follows:

Modify the configuration file under Maven

Settings.xml in the---installation directory

Maven\conf\settings.xml

Find servers modified as follows, or add on:

[Java]View Plaincopy
    1. <servers>
    2. <server>
    3. <id>mytomcat7</id>
    4. <username>tomcat</username>
    5. <password>tomcat</password>
    6. </server>
    7. </servers>



Add Tomcat7-maven-plugin


Externally configured, now configure the Pom in Web engineering to add Tomcat7-maven-plugin

[Java]View Plaincopy
  1. <build>
  2. <finalName>peopleDataShow</finalName>
  3. <plugins>
  4. <plugin>
  5. <groupId>org.apache.tomcat.maven</groupId>
  6. <artifactId>tomcat7-maven-plugin</artifactId>
  7. <version>2.2-snapshot</version>
  8. <configuration>
  9. <path>/${project.build.finalName}</path>
  10. <server>mytomcat7</server>
  11. <!--here is the local tomcat, if the remote server can be changed to the corresponding address for automatic deployment--
  12. <url>http://localhost:8080/manager/text</url>
  13. </configuration>
  14. </plugin>
  15. </plugins>
  16. </build>

That is, adding Tomcat's plugin to the build tag.

<finalName> name of the project that corresponds to itself

Add plug-in configuration-----Do not add the report 400 403 error [Java]View Plaincopy
  1. <repositories>
  2. <repository>
  3. <id>people.apache.snapshots</id>
  4. <url>http://repository.apache.org/content/groups/snapshots-group/</url>
  5. <releases>
  6. <enabled>false</enabled>
  7. </releases>
  8. <snapshots>
  9. <enabled>true</enabled>
  10. </snapshots>
  11. </repository>
  12. </repositories>
  13. <pluginRepositories>
  14. <pluginRepository>
  15. <id>apache.snapshots</id>
  16. <name>apache snapshots</name>
  17. <url>
  18. http://repository.apache.org/content/groups/snapshots-group/
  19. </url>
  20. <releases>
  21. <enabled>false</enabled>
  22. </releases>
  23. <snapshots>
  24. <enabled>true</enabled>
  25. </snapshots>
  26. </pluginRepository>
  27. </pluginRepositories>



Start TOMCAT7, perform maven build

Configure goals

Successful deployment after clicking Run

This item is already visible in Tomcat's admin interface or folder.

Run directly in the MyEclipse

We start directly through the MyEclipse, sometimes error, but this situation can be solved.

The cause of the error

By default, MAVEN's resources Tomcat is not recognized, and once deployed directly using the previous method, there is no configuration file in Classpath.


I just want to use MAVEN to manage the jar package, as far as the development of the deployment to the Web server for debugging, I still want to let MyEclipse help me to complete, how to configure, in order to let the deployment past, the configuration file appears in the Web-inf/classes directory?

We're going to check to see if there are files in resources under the directory that was added to Tomcat.

Inspection found, and sure enough.

Then we're going to set the release path to the resources folder.

To the project right-click Properties--->myeclipse--->deployment Assembly set the resource folder output path to the same as Src/main/java

OK, so we can start the project and debug directly in the MyEclipse.

Start without error, and page access can also be used.

At this time the path of the project is the path of the web/root we set up, ipfilterm, the difference between playing the war package and putting it into Tomcat run.

<tomcat-users>
3  <rolerolename="manager-gui"/>
4  <rolerolename="manager"/>
5  <rolerolename="manager-script"/>
6  <userusername="tomcat" password="tomcat"roles="manager-gui,manager,manager-script"/>
7 </tomcat-users>
[Java]View Plaincopy
    1. <tomcat-users>
    2. <role rolename="Manager-gui"/>
    3. <role rolename="manager"/>
    4. <role rolename="Manager-script"/>
    5. <user username="Tomcat" password="Tomcat" roles="Manager-gui,manager,manager-script"/>
    6. </tomcat-users>

MyEclipse using the Summary--maven project how to start a run publish to Tomcat [go]

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.