2005-07-25

Using Eclipse WTP 0.7RC2 with a maven project

When you want to develop web app on eclise, you have not many choices, but the picture is changing as the WTP project is reaching a stable build by the end of the month.
WTP is a very promising eclipse extension, that seems to have been very well though from the ground up, and from my point of view gives you better control than myEclipse (what I have been using so far).

It took me about a day to be able to use wtp 0.7rc2 with my maven projects. I couldn't find any relevant up to date documentation but some bugzilla entries and some outdated test plans. I am writing this post to not forget what I have been doing so far.

Basically a maven project is a project with the following features:
  • separation of sources by topic java, test, webapp
  • usage of external libraries with a variable (MAVEN_REPO)
  • eclipse project dependency where needed (<eclipse.dependency>true</eclipse.dependency>)
This tutorial only describes how to setup your eclipse project to use WTP to build a deployable webapp using separation of sources, externals jar and project dependencies.

[ArtifactId] will denote the current project name as per maven standards

This is still a very manual process, hopefully either the eclipse maven plugin or the mevenide eclipse plugin will be enabled to generate/edit/synchronize those configuration files.

Setup: eclipse 3.1 + wtp 0.7 RC2 or RC3
Of course you also need to install EMF/GEF/JEM plugins. I highly recommend installing in an extension directory (a directory with an eclipse subfolder and an empty file named .eclipseextension), so it is easy to switch versions and update to the latest version without having to reinstall eclipse from scratch.

I have two kind of projects, libraries and webapps. Libraries are used by webapps. This setup looks exactly like what is described by Integrating existing maven projects in WTP and by Flexible project test plan. But following those instructions written for WTP-M3 won't work with the current release of WTP.

I assume the projects are already setup as standard eclipse projects and compiling. To edit configuration files, you should switch to the resource perspective and disable "build automatically".

Step 1: setup the library projects
Edit .project there should be 3 builders in the following order:
  • org.eclipse.wst.common.modulecore.ComponentStructuralBuilder
  • org.eclipse.jdt.core.javabuilder
  • org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver
Then 2 natures in the following order:
  • org.eclipse.jdt.core.javanature
  • org.eclipse.wst.common.modulecore.ModuleCoreNature
(This step is optional) Edit .classpath (you can also do this through the interface) Change the default output folder to .deployables/[artifactId] for src/java.

Create a .wtpmodules file that contains the following code
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId">
 <wb-module name="[artifactId]">
  <module-type module-type-id="jst.utility"/>
  <wb-resource path="/"/>
 </wb-module>
</project-modules>

Step 2: setup the webapps
Edit .project and add the following builders
  • org.eclipse.wst.common.modulecore.ComponentStructuralBuilder
  • org.eclipse.jdt.core.javabuilder
  • org.eclipse.wst.validation.validationbuilder
  • org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver
  • org.eclipse.wst.common.modulecore.DependencyGraphBuilder
Add also the following natures:
  • org.eclipse.jem.workbench.JavaEMFNature
  • org.eclipse.jst.j2ee.web.WebNature
  • org.eclipse.jdt.core.javanature
  • org.eclipse.wst.common.modulecore.ModuleCoreNature
Edit .classpath so that your ouput folder for src/java is .deployables/[artifactId]/WEB-INF/classes.

Create a file .wtpmodules which reads
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId">
 <wb-module deploy-name="[artifactId]">
  <module-type module-type-id="jst.web">
   <version>2.3</version>
   <property name="context-root" value="[artifactId]"/>
   <property name="java-output-path" value="/bin/"/>
  </module-type>
  <wb-resource source-path="/src/java" deploy-path="/WEB-INF/classes"/>
  <wb-resource source-path="/src/webapp" deploy-path="/"/>

  <dependent-module deploy-path="/WEB-INF/lib"
    handle="module:/resource/[libArtifactId]/[libArtifactId]">
   <dependency-type>uses</dependency-type>
  </dependent-module>
  <dependent-module deploy-path="/WEB-INF/lib"
    handle="module:/classpath/var/MAVEN_REPO/[groupId]/jars/[artifactId]-[version].jar"/>
 </wb-module>
</project-modules>

The handle protocol is as follow:
  • classpath is a classpath reference, the second item on the path can be lib or var (as the kind attribute in the .classpath file)
  • resource is an eclipse flexible project reference, the second item being the project name, and the third item a module within the project. dependency-type can be uses which build the jar for you or consumes which copy the files across.
To generate your .wtpmodules file you can copy/paste the section of .classpath which contains references to external jars and replace [classpathentry kind="var" path="] by [dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/var/]

You can now enable "automatic building", and your webapp should be assembled in the .deployables directory. You can then rigth-click your webapp project icon and Run it on the server of your choice.

This is a very error prone process, as there is no error or warning if you provide a broken .wtpmodules file.

Any comments appreciated.

89 comments:

Anonymous said...

Great explanation of modules definition, thanks. it even works for the final release of WTP 7.0

Anonymous said...

Is there a way to do a simple copy from anywhere from my eclipse project to anywhere to .deployables directory ?
I nee that because my web.xml file is in the conf directory of my eclipse project and I need to deploy it in .deployables/WEB-INF.

Mirco Attocchi said...

very usefull. I use for automate coping some .jar in /WEB-INF/lib

Roberto Iza Valdés said...
This comment has been removed by a blog administrator.
Anonymous said...

Worked for me (M8, WTP 0.7), thanks!

Richard said...

When I do this, it correctly creates files under my .deployables/Project/WEB-INF/lib directory, but they don't have the .jar suffix. If I rename them then Tomcat will see them, if not then it doesn't. I could swear that this worked the last time I tried it, too. Any help would be very much appreciated.

yadong.biz said...

I accidentally searched and visited your site. I still saw several posts during my visit, but the text was neat and readable. I will quote this post and post it on my blog. Would you like to visit my blog later? Feel free to visit my website;
일본야동
일본야동
국산야동
일본야동
한국야동

yahanvideonet said...

Wonderful items from you, man. I’ve have in mind your stuff previous to and you’re just extremely excellent. I actually like what you’ve acquired here, really like what you’re saying and the way in which through which you assert it. You’re making it entertaining and you still care for to keep it smart. I cant wait to read far more from you. That is actually a terrific web site. Feel free to visit my website;
일본야동
일본야동
국산야동
일본야동
한국야동


koreayadongcom said...

Hello there, You have performed an excellent job. I will definitely dig it and personally suggest to my friends. I’m confident they will be benefited from this web site. Feel free to visit my website;
일본야동
일본야동
국산야동
일본야동
한국야동

chinayadongnet said...

Hard to ignore such an amazing article like this. You really amazed me with your writing talent. Thank for you shared again. Feel free to visit my website;

일본야동
일본야동
국산야동
일본야동
한국야동

japanyadongcom said...

Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web! Feel free to visit my website;
일본야동
일본야동
국산야동
일본야동
한국야동

javmost said...

ดูหนัง av ญี่ปุ่น jav เอวีซับไทย หนังโป๊ ฟรี ตลอดทั้งปี av th แหล่งรวม หนัง xxx เล่าเรื่องเสียว ที่จะทำให้คุณได้รับความเพลิดเพลินในการรับชม javmost

Good said...

Free to play, leading, premium, surf strategy, strategy, strategy, strategy, engine... Multi surf for free Go and try to play until you may think that surfing the web. and recommend that you do not stray , เติมเกม

Anonymous said...

Pgslot 7-day continuous deposit promotion

Conditions for receiving

1. All customers must be members on the website with us, both old and new customers.

2. The customer must have Deposit 500 baht per bill or more, 1 time

3. Customers come to work Continuous deposit within our website for 7 consecutive days

4. Customers can receive immediately 500 baht.

**note**

- Make the balance 2 times, withdraw up to 50,000 baht ambbet

Jackergame said...

บอลพรีเมียร์ลีก Very helpful! I am currently on the hunt for a platform that will best fit my needs. This gave me more options to consider!

Courses said...

The blog and data is excellent and informative as well your work is very good and I appreciate well hopping for some more informative posts.
Business Analytics Course in Gurgaon

pgslot said...

Slots to find their own techniques and to play in real online slots games. The prize distribution of each slot game is distributed every hour. Some give out every time you press Spin or spin the full amount according to the rules, including the rows that are arranged according to the Line of the game that is specified. Prizes and jackpots will also increase. Slot games can be considered as a game that has a low investment and a really big profit. because starting from 2 baht until 2000 pgslot

phim33 said...

Si desea obtener ganancias de los juegos de apuestas, tenemos una buena guía que es una guía de juegos profesional que los jugadores han utilizado para presentarle más formas de jugar. Juegue juegos para que pueda ganar aún más premios para principiantes y principiantes. También nos gustaría recomendar a Jiri como su opción de apuestas. El precio de este juego es que incluso si es un juego completamente nuevo, ¿sabe que puede generar grandes pagos? ambbet

ambbet said...

Playing Slotxo with good sites and above all else that must most important And playing with it is control, sanity, and there must be a good rhythm to play. because online games It has changed all the time and there is still very little time to come into play. When you have free time, you need to look and plan. To play well because it will cause problems. Everything was resolved. To play well and carefully will bring the most enormous amount of money ambbet

hp said...

Slots are the most popular online games. The game with the fastest mobile phone support for smartphones. and the most convenient because with the method of applying through the automatic system And there is a fast deposit with an automatic system. Importantly, there is no limited area to play using the Internet to connect to this. Making money with online games is very easy in this era. ambbet

nnoo said...

Many people are still addicted to playing. in old style That is, if you want money from playing here a lot or starting that should not be less over a thousand per day will be considered the least and don't waste time to enter here Should be able to play at least 2 hours a day, or some people may force themselves to continue playing at 2 hours and per day should not have to play more than 3 rounds of games ambbet

Anonymous said...

pgslot things you should know before playing games
after getting to know already famous camp Now let's take a closer look at what we should know. before playing so you can Make better profits, not many, which in the beginning, many people may have some in the part that they do not understand is normal But if you play for one or two eyes pgslot

สล็อต said...

the fastest, the game is interesting to play, there are many characteristics and every time playingthe fastest, the game is interesting to play, there are many characteristics and every time playingthe fastest, the game is interesting to play, there are many characteristics and every time playing สล็อต

nnoo said...

Selling characters, making money from playing games in the old days. Is to spin the characters that we play to be good and have enough strengths. In order to sell to people who are interested in playing, come to buy our characters to use in playing. which perhaps these characters must rely on the addition of the game to update the character to be more skilled which of course if how good have more chances pgslot

mary said...

Online slots, if you want to interpret more Gambling games are a simple way to earn money. don't think too much Or known as a shortcut of the other person who already knows that. Here, there are real payouts that go along with the fun of playing. สล็อต

mowan said...

want to be a millionaire with little capital Choose to play with the big web slots. free credit giveaway No need to deposit first like PGSLOT superslot เครดิตฟรี

Bell said...

Entertainment, stress relief and easy money, many of you may think. It's a joke, but in fact, online slots can help you earn real money in no time. บาคาร่า

Boomza said...

nction that allows us to spin the wheel. And this button must be said that it is the most important in the game that it is as important as t บาคาร่า ออนไลน์

Anonymous said...

The volume of the website does not go through middlemen, satisfaction, easy to play, fast money. ambbet

Anonymous said...

The newest mobile game adapted to the online gaming system. is a website that combines slot games ambbet

ตุ๊กตา said...

Worth it since being a member If you want the value of playing slots, don't wait. Apply via line @. pgslot

mary said...

pg Slot This camp has many promotions, whether from new registration to old membership, and there are bonuses that are easy to break, absolutely easy to break, meet international standards. superslot

วุ้นเส้น said...

You immediately hit the jackpot of the game. which is an online slot game that are similar to slot machines superslot

Anonymous said...

When the story of the ghost of Krahang is not clearly stated. Themes in the game are designed to be awesome with beautiful colors and images. ambslot

Anonymous said...

All game camps now come in one application. so that the players Get comfortable in playing บาคาร่า

Anonymous said...

Dinosaur slot game with cute images. It is a 5-reel, 3-row slot game. Sign up and join in the fun. ข่าวบอลล่าสุด

shadepo said...

add-ons to buy will be impossible If not a free spinner There are many games especially new games will focus on some players who do not have to wait for free spin superslot เครดิตฟรี

pg said...

Watch live ball Watch Ball Online Watch TV Online Today's ball schedule, live schedule, live ball program ข่าวบอล

nnoo said...

Currently, our slot games have many winning lines, starting from 1 line or more, giving you more chances to get more lines. high chance of winning pgslot

poom said...

Today, the website includes slot games. Our Chinese will be introduced. Online slots games that are hot and deserve to be wagered ambbet

9999 said...

สูตรป๊อกเด้ง

9999 said...

เล่นป๊อกเด้งออนไลน์

9999 said...

สอนเล่นบาคาร่า

9999 said...

บาคาร่าประกันภัย

9999 said...

วิธีเล่นบาคาร่าให้ชนะ

9999 said...

บ่คาร่าวัววัว

9999 said...

รูเล็ตออนไลน์

Anonymous said...

combo attack will get you red diamonds where you can collect red diamonds to access the Free Spins feature. ข่าวบอล

Anonymous said...

using own money It's like an additional investment from the bet or not, it's guaranteed that it's definitely more than worth it, such as ambbet

Anonymous said...

on the screen, making it possible to make money immediately Many times the number of fish on the screen. pgslot เว็บตรง

Hp said...

Our web service provider will develop the system even further. With over 10 years of experience, we will certainly not disappoint our players. pgslot เว็บตรง

pattap said...

Try to play and like to apply for membership later. no obligation Freedom to choose as you like slotxo

Boomza said...

al money because our webal money because our website provides good slot games. Aes. And the website is สล็อตออนไลน์

pgslot said...

985 joker123 With today's economic conditions into a relatively sluggish state, it is very sluggish to earn extra income or earn additional income. pgslot เว็บตรง

play said...

PGSLOT new online game That unconventional online slots games will go because this is PGSLOT.BIO. pgslot เว็บตรง

loverboss said...

Games to choose to play to the fullest. Play slots with beautiful images and the easiest jackpot to break. Easy to play for real money pgslot เว็บตรง

Anonymous said...

No. 1 in Thailand, both attractive to play, safe, extremely reliable on that website joker123

Anonymous said...

A giant that meets international standards not through agents or agents welcome your slotxo

loverboss said...

The website combines easy-to-break slot games to use the service. This will allow us to decide to choose a service with a standard gambling website and have the opportunity to make more money. pgslot

pgslot said...

gamblers are playing in this Jili game camp and for various games. In our gaming camp, the pgslot

Anonymous said...

Ready to be a new millionaire immediately Today we come to present techniques.welcome pgslot เว็บตรง

Noud said...

Our web site has a metaverse audio and graphics system which is considered the most standard system today. along with being able to actually use without interruption สล็อต

Noud said...

Profitable, which some people may blame as a mechanism of the LIVE22 slot game that keeps cheating money. of the players because the round has numbers that are not สล็อต

punrice said...

ufabet888imi55สล็อต168บาคาร่าออนไลน์ ได้เงินจริงlucabet เครดิตฟรี ล่าสุดcasino online เว็บตรงbet24hสล็อต pgทดลอง ตารางคะแนน

Anonymous said...

Modern, often broken, full bonuses than all camps
There is a wide variety of games to choose from. สล็อตออนไลน์

namwan said...

the best game that comes from Voting of people around the world, not just the team or Thai people in the country. สล็อต

Anonymous said...

For free credit service, no deposit required, no sharing required. That is another impressive service. pgslot เว็บตรง

Anonymous said...

Play unlimited profits, including slot pros, deposit 1, get the latest 50, get bonuses including slot camps pgslot

GUN said...

Wherever you go, just enter the slot game in the world.Wherever you go, just enter the slot game in the world. pgslot เว็บตรง

Anonymous said...

Convert to 3 free Samurai feature spins, then shuffle the free spin sequence. and positioned above the shaft During the rotation of the ninja total prize money slotxo

GUN said...

able to withdrawable to withdrawable to withdrawable to withdrawable to withdrawable to withdraw ดูบอลสด

pgslot said...

to everyone, get to know and be able to use it. At the time to play slot games, whether you are a pgslot

Anonymous said...

Let you make huge money And with low investment, no matter how small you are, you can play. สล็อต

king said...

What does the operating system play with? What does the operating system mean? A program that works as an intermediary between the user of the device and the hardware. AMBKING

Anonymous said...

There are few, they can play. There are a lot of opportunities to get rich. By the game, we have all camps in here. pgslot

Anonymous said...

You will find a new dimension of gambling in slots games.
But all have a complete service. pgslot

Anonymous said...

Can play any online slots game in the World Cup. Import online slot games from around the world. ดูบอลออนไลน์

Anonymous said...

Profitable at any time today, so we will recommend. Slot game is hard to break. Full. AMBKING

Anonymous said...

Apply for membership and make deposits and withdrawals through the automatic system. fast no need to wait long AMBKING

Noud said...

Makes you have fun before anyone else with a website that can be played through the mobile phone that you use often, no matter what model it is, just being ข่าวบอลวันนี้

Anonymous said...

At these favorite gamblers, there are also many bonuses in the game. If you are looking for ถ่ายทอดสดบอลวันนี้

Anonymous said...

directly, not through agents big web slots with a safe and reliable system welcome pgslot

cxvvx said...

Pgslot, the number one betting website that you can choose to play and also comes with activities for you to participate in pgslot

ตุ๊กตา said...

game because it is a game camp that can make money easily overnight. So you don't need to ดูบอลสด

Anonymous said...

96.78% Volatility Rate : Medium Max Win Rate : x5000 System Supported : iOS, Android, Windows, Mac OS, HTML5 Free pgslot

ตุ๊กตา said...

also a technique that helps reduce good risks and also allows us to play games longer as well. ดูบอลออนไลน์

Anonymous said...

games and a lot of quality games that everyone can choose to play as they like and can enjoy every pgslot

namwan said...

Formula to win the first slot game who would like to recommend that all players choose to follow Is trying to look for games with high RTP. This is one of the ways to play slots for money. สล็อต

GUN said...

That online slot It's not just the technique ofThat online slot It's not just the technique of pgslot เว็บตรง