This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 97118 - War file is created on each run of web application
Summary: War file is created on each run of web application
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Web Project (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Tomas Mysik
URL:
Keywords: PERFORMANCE
: 103518 (view as bug list)
Depends on: 103517
Blocks:
  Show dependency tree
 
Reported: 2007-03-02 16:45 UTC by Petr Jiricka
Modified: 2007-07-19 15:46 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
will this patch help clariify an approack (7.98 KB, application/octet-stream)
2007-06-12 02:03 UTC, Vince Kraemer
Details
post-review (8.35 KB, text/plain)
2007-06-12 17:26 UTC, Vince Kraemer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2007-03-02 16:45:52 UTC
1. Create a web project (Tomcat is the target server)
2. Run it
=> war file is created in the dist directory, even though Tomcat does not need
it, as the application is directory deployed.

This is a performance issue.
Comment 1 Petr Jiricka 2007-03-02 16:51:16 UTC
This is because the "Create WAR File" checkbox in the project customizer
(Packaging section) is cheched by default when you create a new project.

Stepan suggested the following solution:
- The "Create WAR File" checkbox will be removed from the project customizer. 
- Whether or not to produce the war file will be detected automatically by the
project, based on whether the target server supports directory deployment.
- There will be an action on the popup menu called "Export WAR File" (or
similar), that will call the war target, and that the user can use to produce
the war.
Comment 2 Radko Najman 2007-03-13 16:35:30 UTC
I understand it is a performance issue but is it a real bug? It is implemented
by this way for a few releases and if the proposed solution needs an UI change
and introducing a new popup action it seems more like a performance enhancement
than a defect.

Do we want to do it for 6.0?
Comment 3 Petr Jiricka 2007-03-13 18:35:48 UTC
I want it for 6.0 :-)
Comment 4 Sherold Dev 2007-03-14 10:39:23 UTC
Maybe we shouldn't remove that checkbox completely, it should be just unchecked
by default.
Comment 5 Petr Jiricka 2007-03-14 10:49:22 UTC
Sounds good, but what about servers that do not support directory based
deployment? Maybe it should be checked/unchecked at project creation time based
on whether the server supports dir.deploy or not.
Comment 6 Sherold Dev 2007-03-14 11:26:24 UTC
my comment was probably a bit confusing.. i was commenting only removal of the
checkbox not the rest of the solution
Comment 7 Radko Najman 2007-05-09 10:59:32 UTC
*** Issue 103518 has been marked as a duplicate of this issue. ***
Comment 8 Vince Kraemer 2007-05-09 15:57:00 UTC
Instead of doing all these changes... have we considered changing the order of
operations...

current order:
1. build the classes
2. create the war file
3. deploy from the build directory...
4. open the browser

new order (when directory deploy is supported)
1. build the classes
2. deploy from the build directory...
3. open browser
4. build the war file 

This solution would depend on issue 103517
Comment 9 kirillkh 2007-05-31 23:37:46 UTC
I'd go with leaving the checkbox disabled by default. If the target server
doesn't support directory deployments, gray the checkbox out. Do this check
every time the user selects a different server.
Comment 10 kirillkh 2007-05-31 23:38:45 UTC
s/disabled by default/unchecked by default/
Comment 11 Vince Kraemer 2007-06-12 02:03:37 UTC
Created attachment 43537 [details]
will this patch help clariify an approack
Comment 12 Vince Kraemer 2007-06-12 02:14:15 UTC
I think the "pattern" for this patch also applies to ejb, app-client and ear
projects.
Comment 13 Petr Pisl 2007-06-12 12:50:51 UTC
PP01: This patch doesn't influence the UI. So it means that the patch implicates
your suggestion form May 9?
From the diff I'm not able to recognized correctly what the patch does. Could
you describe it?

PP02: In the setDirectoryDeploymentProperty you use string
"directory.deployment.supported". It would be better to have it as a static
constant.

PP03: Use //I18N comments
Comment 14 Vince Kraemer 2007-06-12 17:18:52 UTC
PP01: The patch implements the following:

an additional property is set in the WebActionProvider.java. This property "tells" the build script whether the plugin
that will be called by to do the actual deployment supports directory deployment.

I replaces the call to dist with a pair of targets that do the packaging, if it is required to do the deploy... dist
doesn't include that kind of check... dist makes a war... no matter what.

PP02: can do.

PP03: will do, where they apply after implementing PP02...
Comment 15 Vince Kraemer 2007-06-12 17:26:58 UTC
Created attachment 43560 [details]
post-review
Comment 16 Petr Pisl 2007-06-15 15:04:15 UTC
I'm sorry for the late response. I looked at the new diff properly and it seams to me that there are two problems.

PP05: The -post-dist target will not be called.

PP06: The checkbox "Create WAR file" will be ingnored if the server has directory deployment capability. 
Comment 17 Vince Kraemer 2007-06-15 15:38:17 UTC
Re: PP05... yup, because the dist is not being called...

Re: PP06... yup, but only when the user is not trying to build a war... they are trying to run the project...  The Build
action will still create the war file.

Ok.  From the looks of your comments, you think the war file SHOULD BE created when the user selects the:

Run File, Run Project and Run Main Project actions on a Web App that will be directory deployed.

That is in direct conflict with the initial description of the bug.

If we are going to continue wasting the user's time, by building a war file that they did not ask for... can we at least
do it AFTER the web app has been directory deployed and the browser has been opened?

Comment 18 Petr Pisl 2007-06-15 16:07:03 UTC
Re:Re: PP05

But still there is a comment in the build.xml that user can customize it:
-post-dist:                called after jar building

I think that if you call -pre-dist you should as well call -post-dist

Re:Re: PP06  You are right. I'm sorry I didn't notice. 

PP07: The debug should work in the same way.
Comment 19 Petr Pisl 2007-06-15 16:53:16 UTC
PP08: I'm look again at the conditions for early.war.package.with.custom.manifest and
early.war.package.without.custom.manifest. It seams that the war file will not be build when a user uncheck Create WAR
file and will use a server, which doesn't have directory based deployment. Then the war file will not be created and the
run target fails. 

Comment 20 Vince Kraemer 2007-06-15 17:17:52 UTC
Note: I am just trying to help out on this issue.  The issue is not assigned to me. I provided a patch to give folks an
idea about one solution strategy.  Obviously, the module owner will need to evaluate this strategy and may choose to
adopt it, adapt it or ignore it... As they see fit. They are responsible for solving the problem.

Calling -post-dist: in the run case that may be dangerous for the user, since they are likely to assume that the jar/war
file is available in their action....  Maybe we should eliminate the call to -pre-dist... 

I don't know.  

PP07: yes.

PP08: I will double check that.  Are we sure that this doesn't happen already (without applying these changes)?
Comment 21 Petr Pisl 2007-06-18 12:55:00 UTC
Regarding to PP08 I think you are true that there is the bug also without applying the patch. I think we should do
things properly. If we change a piece of code and the problem is a part of it we should correct it. 
Comment 22 Petr Jiricka 2007-07-03 12:03:47 UTC
Assigning to Tomas M.
Comment 23 Tomas Mysik 2007-07-12 16:01:47 UTC
Should be fixed this way:
- "temporary" WAR file is created if and only if "Create WAR File" is NOT checked (if it's checked the behaviour is 
unchanged) and directory based deployment is NOT supported
- this applies for running as well as for deploying application

Thanks Vince for inspiration.


Checking in src/org/netbeans/modules/web/project/WebActionProvider.java;
/cvs/web/project/src/org/netbeans/modules/web/project/WebActionProvider.java,v  <--  WebActionProvider.java
new revision: 1.91; previous revision: 1.90
done
Checking in src/org/netbeans/modules/web/project/resources/build-impl.xsl;
/cvs/web/project/src/org/netbeans/modules/web/project/resources/build-impl.xsl,v  <--  build-impl.xsl
new revision: 1.143; previous revision: 1.142
done
Comment 24 Tomas Mysik 2007-07-12 17:38:01 UTC
Default state of "Create WAR file" checkbox changed - it's unchecked now.

Checking in src/org/netbeans/modules/web/project/api/WebProjectUtilities.java;
/cvs/web/project/src/org/netbeans/modules/web/project/api/WebProjectUtilities.java,v  <--  WebProjectUtilities.java
new revision: 1.23; previous revision: 1.22
done
Comment 25 Tomas Mysik 2007-07-19 07:48:15 UTC
Additional fix (thanks Vince).

Checking in src/org/netbeans/modules/web/project/resources/build-impl.xsl;
/cvs/web/project/src/org/netbeans/modules/web/project/resources/build-impl.xsl,v  <--  build-impl.xsl
new revision: 1.146; previous revision: 1.145
done
Comment 26 Tomas Mysik 2007-07-19 15:46:14 UTC
Reverting last change in build-impl.xsl because it doesn't work for JBoss. Run task has to depend on Dist task.

Checking in src/org/netbeans/modules/web/project/resources/build-impl.xsl;
/cvs/web/project/src/org/netbeans/modules/web/project/resources/build-impl.xsl,v  <--  build-impl.xsl
new revision: 1.147; previous revision: 1.146
done