Configure Maven Jetty

Source: Internet
Author: User
Maven jetty Configuration

I recently learned how to deploy maven. I wrote a web application by referring to some examples in the document. I need to configure the jetty plug-in it. I can configure it as follows:

<Plugin>
<Groupid> org. mortbay. jetty </groupid>
<Artifactid> Maven-jetty-plugin </artifactid>
</Plugin>

However, an error is reported during startup:

[Info] ------------------------------------------------------------------------
[Error] No plugin found for prefix 'jetty 'in the current project and in the PLU
Gin groups [org. Apache. Maven. plugins, org. codehaus. Mojo] available from the Repo
Sitories [local (E:/m2/Repository), central (http://repo1.maven.org/maven2
)]->
[Help 1]

Later reference Maven URL: http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin

You can configure the following plug-ins. I have not tried other methods:

<Plugin>
<Groupid> org. mortbay. jetty </groupid>
<Artifactid> Maven-jetty-plugin </artifactid>
<Version> 6.1.10 </version>
<Configuration>
<Scanintervalseconds> 10 </scanintervalseconds>
<Stopkey> Foo </stopkey>
<Stopport> 9999 </stopport>
</Configuration>
<Executions>
<Execution>
<ID> Start-jetty </ID>
<Phase> pre-integration-test </phase>
<Goals>
<Goal> RUN </goal>
</Goals>
<Configuration>
<Scanintervalseconds> 0 </scanintervalseconds>
<Daemon> true </daemon>
</Configuration>
</Execution>
<Execution>
<ID> stop-jetty </ID>
<Phase> post-integration-test </phase>
<Goals>
<Goal> stop </goal>
</Goals>
</Execution>
</Executions>
</Plugin>

 

The problem may have something to do with the version.

 

 

 

Artifactid>
<Version> 2.5 </version>
</Dependency>
4. Add the source code directory src/main/Java
Put the source code in this directory.
5. Add the jetty plug-in.
<Build>
<Finalname> mywebapp </finalname>
<Plugins>
<Plugin>
<Groupid> org. Apache. Maven. plugins </groupid>
<Artifactid> Maven-compiler-plugin </artifactid>
<Configuration>
<Sources> 1.5 </source>
<Target> 1.5 </Target>
</Configuration>
</Plugin>
<Plugin>
<Groupid> org. mortbay. jetty </groupid>
<Artifactid> Maven-jetty-plugin </artifactid>
</Plugin>
</Plugins>
</Build>
6. jetty debugging (http://www.blogjava.net/alwayscy/archive/2007/06/01/118584.html)
Command Line: MVN jetty: Run
Or
1. Configure an external tool to run jetty:
Choose run> external tools... select program on the left and click New:
Configure location
Is the complete command line of MVN. Locate MVN. BAT in Bin.
Select working directory
This project.
Arguments
Enter jetty: Run
Click the enviroment page to add the maven_opts variable. The value is:
-Xdebug-xnoagent-djava. compiler = none-xrunjdwp: Transport = dt_socket, address = 8080
, Server = Y, suspend = y

Where, if suspend = N, it indicates no debugging and runs directly. Address = 8080 is the port
Click Apply and close this dialog box.
Note that the external tool menu item appears only under the perspective of Java browering. If you cannot see it in Java, you can switch to another one.
Start Jetty
2. debug the application
Click Run-> debug...
Select remote Java application in the left Tree and click New.
The key to selecting your project is to enter the same port number as when you set an external tool.

 

 

 

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.