Thursday, September 12, 2013

Java - Jetty to run in eclipse

・・Main
・Location
/usr/share/maven/bin/mvn

・Working Directory
1.Browser Workspace
2.Select the project name

・Arguments
-P staging
jetty:run

・Execute
$ CD /.../workspace
$ mvn jetty:run -P staging

・・Environment
@ For Debugging
MAVEN_OPTS = -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y

・・Run/Debug Configure....
Then, pull up the "Run/Debug Configure...." menu item and select "Remote Java Application" and click the "New" button. Fill in the dialog by selecting your webapp project for the "Project:" field, and ensure you are using the same port number as you specified in the address= property above.
Now all you need to do is to Run/External Tools and select the name of the maven tool setup you created in step 1 to start the plugin and then Run/Debug and select the name of the debug setup you setup in step2.

@pom.xml - Sample
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jp.xxxx.ns</groupId>
<artifactId>html5</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>html5 Maven Webapp</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>public</id>
<name>Internal Repository</name>
<url>http://xxx.xxx.xxx.xx1:x0x1/nexus/content/groups/public/</url>
</repository>
<repository>
<id>stg-common-mvn01</id>
<name>stg-common-mvn01-releases</name>
<url>http://xxx.xxx.xxx.xx2:x0x1/artifactory/libs-releases-local</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>releases</id>
<name>Internal Release Repository</name>
<url>http://xxx.xxx.xxx.xx1:x0x1/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshot Repository</name>
<url>http://xxx.xxx.xxx.xx1:x0x1/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.jetty.version>6.1.26</project.jetty.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>${project.build.sourceEncoding}</encoding>
<vervose>true</vervose>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>${project.jetty.version}</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>3</scanIntervalSeconds>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
</plugins>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
<testResources>
<testResource>
<directory>${basedir}/src/test/resources</directory>
</testResource>
<testResource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
</testResource>
</testResources>
<finalName>ROOT</finalName>
</build>
<profiles>
<profile>
<id>staging</id>
<build>
<resources>
<resource>
<directory>config/staging/resources</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>product</id>
<build>
<resources>
<resource>
<directory>config/product/resources</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>servlet-api</artifactId>
<version>6.0.33</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.3</version>
</dependency>
</dependencies>
</project>
view raw pom.xml hosted with ❤ by GitHub

No comments:

Post a Comment