| Author |
Message |
|
|
Post subject: How to exclude WEB-INF/lib from deployment and exported WAR
Posted: Dec 16, 2008 - 10:21 PM
|
|
Registered Member


Joined: Jul 12, 2006
Posts: 12
|
|
I'd like to exclude my JARs from the WAR exported from MyEclipse, and from the Tomcat instance I deploy to during development
Under "Properties | MyEclipse | Web" I set "Library Deployment Policies" to all off so -- supposedly -- that no JARs included in deployment. However, when I redeploy, the JARs still end up in the expanded web app on Tomcat, and the JARs are also in the WAR when I Export.
I'm using "MyEclipse Enterprise Workbench 6.5", version 6.5.1 GA.
What's the procedure? |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: How to exclude WEB-INF/lib from deployment and exported
Posted: Dec 17, 2008 - 02:36 PM
|
|
Registered Member


Joined: Apr 18, 2007
Posts: 8013
|
|
MaxRahder,
If you uncheck all the check boxes in the deployment page then the libraries should ideally not get deployed. Can you tell me what is the location of the jars that are getting deployed? Are these jars on the project build path? |
_________________ Nipun
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 17, 2008 - 06:59 PM
|
|
Registered Member


Joined: Jul 12, 2006
Posts: 12
|
|
Yes, they are all on the build path. Under "Java Build Path | Order and Export" all are de-selected, and under "Properties | MyEclipse | Web | Deployment" all under "Library Deployment Policies" are de-selected.
To test, I did an Export to a WAR, then unzipped it and verified that indeed, WEB-INF/lib contains all the JARs.
The goal is this: We rarely change the JARs, although our own code changes a lot. Deployment and upload to the server would be much quicker if we put the contents of our Web application's WEB-INF/lib folder into Tomcat's shared lib folder, and omitted that folder from the WAR.
Thanks for the help! |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 18, 2008 - 07:04 PM
|
|
Registered Member


Joined: Apr 18, 2007
Posts: 8013
|
|
After unchecking all the options under preference, right click on your project and go to MyEclipse > Add and Remove Project Deployments > (select your project in the Project Dropdown) > Add > Next > (Select <custom Location Suffixed> in the server dropdown and select the appropriate deployment location) > Finish.
Now does the war file generated contain the jars? |
_________________ Nipun
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 18, 2008 - 07:28 PM
|
|
Registered Member


Joined: Jul 12, 2006
Posts: 12
|
|
Thanks for looking into this for me.
Yes, the JARs are there. (They were also in the "exploded" application that was deployed in the process of following the steps you outlined.)
By the way, I am working on an Apple under OSX. (The MyEclipse version is as noted in my previous note in this thread.)
I'll include screen shots!
 |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 19, 2008 - 04:59 PM
|
|
Registered Member


Joined: Apr 18, 2007
Posts: 8013
|
|
MaxRahder ,
Can you switch to a new workspace, create a new web project, add some jars to it and they try deploying the project with the jar deployment unchecked under preferences. Do you face the same issue in the new workspace with the new project? |
_________________ Nipun
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 23, 2008 - 06:01 PM
|
|
Registered Member


Joined: Jul 12, 2006
Posts: 12
|
|
I tried what you suggested and got the same results.
1. I created a new workspace
2. I created a new web project
3. I imported a bunch of JARs into the WEB-INF/lib folder
4. I went to menu option "Properties | MyEclipse | Web | Deployment" and de-selected all check boxes under "Library Deployment Policies"
5. I verified that JARs should not be included by looking at "Properties | Java Build Path |Order and Export" and seeing that all JARs are de-selected
I then did an "Export | J2EE | WAR file" and saved it to my local hard drive. I unzipped it -- the JARs are in WEB-INT/lib.
I can show you if you'd like. I could set up a DimDim webcast and you can watch me go through the steps (and make suggestions as I go). |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 23, 2008 - 07:14 PM
|
|
Registered Member


Joined: Apr 18, 2007
Posts: 8013
|
|
MaxRahder,
I want to clarify something here. The changes that you make under Windows > Prefs ... are applicable when you deploy your application. These changes are not applicable if you export you project by going to Export > J2EE > WAR.
So you will have to deploy your project as a war file and then the libraries should be omitted. |
_________________ Nipun
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 23, 2008 - 07:45 PM
|
|
Registered Member


Joined: Jul 12, 2006
Posts: 12
|
|
I'm not sure what deployment options are available. The goal is to product a WAR,that excludes JARs using whatever procedure you describe.
Regarding "deployment" versus "exporting", I'm using the "Project Deployments" button to associate the Web application with my Tomcat install. I had been using "exploded" deployments (which, by the way, did include the JARs), but just now I tried this:
Under Project Deployments I removed my project from Tomcat. (And I looked in the file system to verify that it was gone.) I then re-deployed by choosing my project, choosing my Tomcat, then selecting deploy type "Packaged Archive (production mode).
I then inspected the WAR deployed in my Tomcat's webapps folder and, sure enough, the JARs are still there.
To reiterate: I don't know how to create a WAR that excludes the JARs in my WEB-INF/lib folder. Everything I've done so far to make this work has been a guess. I don't know the proper procedure, which is why I'm writing.
Thanks for your help! |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 23, 2008 - 08:13 PM
|
|
Registered Member


Joined: Apr 18, 2007
Posts: 8013
|
|
MaxRahder,
You are on the right track. You have to use "Project Deployment". When you deploy your project and check the Tomcat/webapps folder, the deployed project should not include the jars on the build path. Even if you select an exploded deployment, the jars should not be included.
I would like you to try out the following steps:-
1. Go to windows > Prefs > MyEclipse > Java enterprise project > Web project > Deployment and uncheck the options. This will apply the deployment options at a generic level.
2. Create a New Web Project.
3. Add some jars on the build path of this newly created project.
4. Open the Project deployment window. Select this project in the drop down and hit Add. The New Deployment window should open up.
5. Select <Custom Location - Suffixed> in the server dropdown.
6. Enter the location where you want to create the war file.
7. Hi Finish and then OK.
8. Go to the deployment location and check if the libraries got deployed.
9 If they did, please go to MyEclipse > Installation Summary > Installation Details and paste the information here for me. |
_________________ Nipun
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 27, 2008 - 05:10 PM
|
|
Registered Member


Joined: Jul 12, 2006
Posts: 12
|
|
Thanks for the help.
I followed your instructions, and the JARs are still included. As you described, the new project indicates that it's using the workspace default settings for Web deployment, and indicates that the default does not include JARs. (All four JARs checkboxes are un-checked.) This also seems to be confirmed by the project "Order and Export" page, which shows all JARs de-selected.
I've copied my installation details below.
Thanks again!
| Code: |
*** Date:
Saturday, December 27, 2008 11:01:32 AM CST
** System properties:
OS=MacOSX
OS version=10.5.6
Java version=1.5.0_16
*** MyEclipse details:
MyEclipse Enterprise Workbench
Version: 6.5.1 GA
Build id: 6.5.1-GA-20080715
*** Eclipse details:
Eclipse SDK
Version: 3.3.2
Build id: M20080221-1800
Eclipse Project SDK
Version: 3.3.3.r33x_r20080129-7M7J7LB-u3aphGW6o3_VmiVfGXWO
Build id: M20080221-1800
Eclipse Platform
Version: 3.3.3.r33x_r20080129-_19UEl7Ezk_gXF1kouft
Build id: M20080221-1800
Eclipse Java Development Tools
Version: 3.3.2.r33x_r20080129-7o7jE7_EDhYDiyVEnjb1pFd7ZGD7
Build id: M20080221-1800
Eclipse Graphical Editing Framework
Version: 3.3.2.v20080129
Build id: 20080221-1602
Eclipse RCP
Version: 3.3.3.r33x_r20080129-8y8eE9UEUWI6qujeED0xT7bc
Build id: M20080221-1800
Eclipse Plug-in Development Environment
Version: 3.3.3.r33x_r20080129-7N7M5DQVIA_6oJsEFkEL
Build id: M20080221-1800
Eclipse startup command=-os
macosx
-ws
carbon
-arch
x86
-showsplash
-launcher
/Users/max/Documents/Developer/eclipse 3.3/Eclipse.app/Contents/MacOS/eclipse
-name
Eclipse
--launcher.library
/Users/max/Documents/Developer/eclipse 3.3/Eclipse.app/Contents/MacOS/../../../plugins/org.eclipse.equinox.launcher.carbon.macosx_1.0.3.R33x_v20080118/eclipse_1023.so
-startup
/Users/max/Documents/Developer/eclipse 3.3/Eclipse.app/Contents/MacOS/../../../plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar
-keyring
/Users/max/.eclipse_keyring
-consoleLog
-showlocation
-vm
/System/Library/Frameworks/JavaVM.framework
|
|
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 29, 2008 - 08:58 PM
|
|
Registered Member


Joined: Apr 18, 2007
Posts: 8013
|
|
MaxRahder,
Can you please post a screenshot of project (nodes) expanded in the package explorer with the libraries showing up. Please expand all the directories.
Im sorry this has taken so long to resolve. I'm sure we a are missing some basic step. |
_________________ Nipun
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 29, 2008 - 08:58 PM
|
|
Registered Member


Joined: Apr 18, 2007
Posts: 8013
|
|
You can even try upgrading to MyEclipse 7.0 and testing this again incase you have some time to spare. |
_________________ Nipun
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 30, 2008 - 12:35 AM
|
|
Registered Member


Joined: Jun 12, 2005
Posts: 45
|
|
Nippun:
| Quote: | 3. Add some jars on the build path of this newly created project.
|
MaxRahder:
| Quote: | 3. I imported a bunch of JARs into the WEB-INF/lib folder
|
Jars in lib will surely be deployed ! (??)
A misunderstanding ? (feel free to ignore / supress if I am off base)
regards
J-M |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Dec 30, 2008 - 05:47 PM
|
|
Registered Member


Joined: Apr 18, 2007
Posts: 8013
|
|
J-M,
Thanks for pointing this out.
@MaxRahder: Can you try adding the jars to the build path instead of importing them. |
_________________ Nipun
MyEclipse Support
|
| |
|
|
|
 |
|
|