Date: Tue, 19 Mar 2024 07:03:45 +0000 (UTC) Message-ID: <1502503901.54567.1710831825642@cwiki-he-fi.apache.org> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_54566_2082462939.1710831825642" ------=_Part_54566_2082462939.1710831825642 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This note is to describe the above plugin. which will run your web appli=
cation in an embedded Jetty6 instance by just
typing "mvn jetty:run"
- No need to download or install Jetty=
manually, it's all automatic once the Maven project
descriptor's set up (the pom.xml)
Add the following to the <build><plugins>
block=
of your projects pom.xml
<plugin>= ; <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> </plugin>
In order to run Jetty on a webapp project which is structured according = to the usual Maven defaults, you don't need to configure anything.
Simply type:
mv= n jetty:run
Due to a bug in maven or the maven-jetty-plugin= this only works if no jetty artifact is present in the dependencies sectio= n of the pom.xml file. This is the case for wicket-quickstart, wicket-examp= les and wicket-threadtest. So the tips given here can't be applied to those= projects.
I couldn't find a command line reference for maven2, but the one given f= or maven1 still aplies for the = feature used here:
First set MAVEN_OPTS environment variable with the following command:
export MA= VEN_OPTS=3D'-Xdebug -Xrunjdwp:transport=3Ddt_socket,address=3D4000,server= =3Dy,suspend=3Dy'
After setting this property, run "maven jetty:run" and it will block, wa= iting for a debug connection. If "suspend=3Dn" is set, it will start right = away.
Running Eclipse Open "Run --> External Tools --> External Tools...= --> Program". Press "New launch configuration". On the "Main" tab, fill= in the "Location:" as the full path to your "mvn" executable. For the "Wor= king Directory:" select the workspace that matches your webapp. For "Argume= nts:" add jetty:run.
Move to the "Environment" tab and click the "New" button to add two new = variables:
name |
value |
---|---|
MAVEN_OPTS |
-Xdebug -Xnoagent -Djava.compiler=3DNONE -Xru= njdwp:transport=3Ddt_socket,address=3D4000,server=3Dy,suspend=3Dy |
JAVA_HOME |
Path to your java executable |
As above the jvm will start right away when "suspend=3Dn" is set.
Running Eclipse Open "Run --> Debug... --> Remote Java Application= ". Press "New launch configuration". Fill in the dialog by selecting your w= ebapp project for the "Project:" field, and ensure you are using the same p= ort number as you specified in the address=3D property above.
Now all you need to do is Run/Debug and select the name of the debug set= up you setup above.
This article is a gathering of information, credits need to be given to = the authors of the pages behind the given links.
This setup will also allow you to debug your application under Netbe= ans.
Add the following to the <build><plugins>
block=
of your projects pom.xml
<plu= gin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <configuration> <stopPort>9966</stopPort>=20 <stopKey>jetty-stop</stopKey> <scanIntervalSeconds>10</scanIntervalSeconds> </configuration> </plugin>
The stopPort and stopKey parameters can have arbitrary values.
Open the properties window of your Maven project and select Actions from=
the Categories list.
Find the Run action and change the Execute Goals<=
/strong> value to jetty:stop jetty:run
.
Then, do the same for the Debug project action and set th=
e following properties:
jpda.listen= =3Dmaven netbeans.deploy.debugmode=3Dtrue
That's all!