Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 59240 - Editable WAR (EAR, ...) file name
Editable WAR (EAR, ...) file name
Status: VERIFIED FIXED
Product: javaee
Classification: Unclassified
Component: Web Project
4.x
All All
: P3 (vote)
: 7.1
Assigned To: hmvictor
issues@javaee
http://www.netbeans.org/servlets/Read...
: SIMPLEFIX
: 65536 67936 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-05-25 13:52 UTC by zikmund
Modified: 2011-09-26 00:21 UTC (History)
4 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Patch for implementing this issue (29.36 KB, patch)
2011-09-15 01:44 UTC, hmvictor
Details | Diff
Patch for implementing this issue (contains warning message for WAR-EAR projects). (39.91 KB, patch)
2011-09-20 07:13 UTC, hmvictor
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zikmund 2005-05-25 13:52:30 UTC
Make WAR file name editable in project Properties -> it will be saved into
war.name property in nbproject/project.properties file.
Comment 1 zikmund 2005-05-25 14:02:09 UTC
Based on nbusers request:
http://www.netbeans.org/servlets/ReadMsg?list=nbusers&msgNo=53670
Comment 2 zikmund 2005-05-25 14:31:16 UTC
BTW: war.ear.name property should be
  war.ear.name=${war.name}
by default if the name will be editable in project Properties.
Comment 3 David Konecny 2008-04-09 01:19:02 UTC
*** Issue 65536 has been marked as a duplicate of this issue. ***
Comment 4 David Konecny 2008-04-09 01:27:03 UTC
*** Issue 67936 has been marked as a duplicate of this issue. ***
Comment 5 tomwheeler 2011-08-28 15:13:55 UTC
Victor is working on this with Antonio for the First Patch program, so I am adding myself to the cc list.
Comment 6 hmvictor 2011-08-30 05:03:11 UTC
This actions will be made to implement this:

* Make textfield for war name editable in org.netbeans.modules.web.project.ui.customizer.CustomizerWar class.
* Set the value of property war.ear.name to ${war.name} in org.netbeans.modules.web.project.api.WebProjectUtilities.setUpProject

For testing: 

* A test for opening properties dialog and verify the text field for war name is editable.
* Verify that after setting up a project the value of war.ear.name is ${war.name}
Comment 7 vieiro 2011-08-30 07:16:28 UTC
I'm adding myself to the CC list.
Comment 8 vieiro 2011-08-30 17:35:31 UTC
Hi,

It seems WebProjectProperties (org/netbeans/modules/web/project/ui/customizer) has a WAR_NAME property, I think you can use that with another value without breaking backwards compatibility.

Anyway I think you should check for backwards compatibility (open a web project created with a previous version of NetBeans).

The plan seems ok to me.

Cheers,
Antonio
Comment 9 hmvictor 2011-09-15 01:44:13 UTC
Created attachment 110766 [details]
Patch for implementing this issue
Comment 10 vieiro 2011-09-15 08:05:37 UTC
Hi,

I've been taking a look at the patch and I think it's ready for integration.

Cheers,
Antonio
Comment 11 Petr Jiricka 2011-09-15 09:02:05 UTC
Cc'ing David Konecny as the owner of the Web Project module.
Comment 12 David Konecny 2011-09-15 20:58:37 UTC
Hi guys,

thanks very much for the patch. I appreciate your effort!

Before reviewing patch there is one subtle issue I must mention: when a project A is used from a project B then project B stores file name of project A outcome; and renaming project A outcome will not be reflected in project B; unfortunately. In case of Web Project this means for example that if there is a EAR project which references Web Project foo then EAR will contain reference to {some.path}/foo.war. If we implement this issue and user renames foo.war to boo.war then EAR project reference will get broken. This problem is hard to prevent. Imagine for example that user may not even open EAR project in IDE or that single WAR is used from multiple EAR projects. At the moment NetBeans does not store any metadata about who is using who and therefore it is not possible to propagate war rename to all places where it might be used.

Having said that if we think that renaming WAR is very desirable feature then we could still go ahead with it and just warn user in UI if they changed WAR filename - a warning text would popup automatically saying something like "IF this WAR is used from an Enterprise Application then such application will need to be updated with a new WAR name as well" - although simplest way to do that in EAR would be to remove WAR module from EAR and re-add it.

What do you think?

I think that there is probably more WAR projects than WAR-in-EAR projects and so going ahead with this change and adding a warning might be a way to go.
Comment 13 hmvictor 2011-09-20 07:13:49 UTC
Created attachment 110897 [details]
Patch for implementing this issue (contains warning message for WAR-EAR projects).

A warning message is shown when the user changes the name of the WAR file.
Comment 14 David Konecny 2011-09-21 02:41:04 UTC
hmvictor, thanks for the patch. I had a look at it and it looks good.

One minor comment: should not change in WebProjectOperations.java set value of WebProjectProperties.WAR_EAR_NAME property to be based on ${WebProjectProperties.WAR_NAME}? Also the change in the same file one line above (newName to PropertyUtils.getUsablePropertyName(newName)) is consistent with code in WebProjectUtilities but I wonder why it was added to WebProjectUtilities in first place? Why should filename be restricted the same way Ant property names are? Perhaps somebody just reused already existing routine to make "safe" war filename? If I had to choose I would probably remove the restriction from code completely. On the other hand considering that nobody ever complained about this so far we can leave it as it is.

I'm happy with the patch and it is ready to go. Thank you! Can you push it to repo or do you need my help?
Comment 15 vieiro 2011-09-21 05:22:36 UTC
I think Victor (and the rest of NB First Patch mentorees) have no commit rights yet, so I'd appreciate if you could push it to the repo.

Thanks all,
Antonio
Comment 16 David Konecny 2011-09-21 20:22:55 UTC
Thank you Victor for your patch! I commited it on your behalf into NB repository: http://hg.netbeans.org/web-main/rev/56b3dccb5e43
Comment 17 Quality Engineering 2011-09-22 14:48:45 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/56b3dccb5e43
User: David Konecny <dkonecny@netbeans.org>
Log: #59240 - Editable WAR (EAR, ...) file name
patch contributed by Victor (hmvictor@netbeans.org)! thank you
Comment 18 tomwheeler 2011-09-22 15:30:14 UTC
Victor, there is one last step. 

This change should be part of a nightly build by tomorrow.  Sometime after then, please download the latest build from the following URL:

   http://bits.netbeans.org/download/trunk/nightly/latest/

And check to see that your change is now part of the IDE.  If so, please note
the build number (visible in Help->About from the IDE when you verify it) in
this issue and mark the status as VERIFIED.

Thanks again for your contribution to NetBeans!
Comment 19 hmvictor 2011-09-26 00:21:43 UTC
I verified is already included in the nightly builds.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo