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 154562 - Impossible to reference web projects as dependencies
Summary: Impossible to reference web projects as dependencies
Status: RESOLVED WONTFIX
Alias: None
Product: webservices
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Trey Spiva
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-04 07:53 UTC by lexn
Modified: 2008-12-17 20:00 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lexn 2008-12-04 07:53:06 UTC
For a Web-Project, in "project properties" -> "libraries" -> "add project" it is possible to select another web-project
and click ok, however nothing happens (the project is not added as a dependency).

LIKELY CAUSE
In the "Add Project" dialog there is a small panel intended to list JARs to be added as dependencies. However the web
project are distributed as WARs, so they cannot be seen and selected from that list.
If this is the reason behind the problem, then all the project with distribution files other than JARs are affected (EAR
and HAR come to mind).

STEPS TO REPLICATE
1. Need Netbeans 6.5 full java release (java ee, webservices and samples included)
2. File -> New Project -> Samples -> Web Services -> Calculator -> Finish
3. The sample application is split into two projects and does not work out of the box due to compilations errors because
the two projects are unaware of each other.
4. Right click on "CalculatorClientApp" -> Project Properties -> Libraries -> Add Project.
5. Select the "CaculatorApp" in the "Add Project" dialog window. Note that the list labeled "Project JAR files" is empty.
6. Click OK.
7. Verify that the "CaculatorApp" project was not added as a dependency.

NOTES
The mechanism for adding other projects as dependencies does seem to works for regular java2se projects.
Not tested on platforms other than Linux.
Comment 1 Milos Kleint 2008-12-05 08:45:05 UTC
reassigning to web projects for evaluation. 
Can war files be added on ant's compilation classpath? afaik it's not possible in maven projects for example..
Comment 2 Vince Kraemer 2008-12-05 18:11:12 UTC
A war file cannot be used as a dependency since it is not a jar.  If the UI lets a user select a war file, the dialog's
'accept' button should probably be disabled.

Should projects that aren't "classic" jar files be acceptable values for the 'Add Project" dialog? No.
Comment 3 lexn 2008-12-08 23:52:44 UTC
The Netbeans own sample project Calculator is using the ability to add webprojects as dependencies, which is how the bug
was discovered.
Taking out that feature would make project management for web-project unnecessarily complicated and force users to put
everything into one project. Again, please refer to the layout of the sample Calculator project that comes with Netbeans
web-services: one project for a web-service and another project for the client.

Also this feature was in 6.1 and worked just fine...
Moreover, typing the path to the war file in the "File" text-box in "Dependency Selection" dialog causes Netbeans to add
the war file to the classpath, after that everything compiles. The war file is also included in a web-app lib folder,
and the web-app works when deployed on the server.

Perhaps this issue requires more evaluation rather than "if it's not a jar it should not be on a classpath" approach?

The internal layout of a war file the same as a jar file with extra files that are web-app specific. The extension
difference signifies the fact that it can be deployed on a web-server, it doesn't make it less of a jar. It means it's a
jar with MORE to it, not LESS.

You can't just wipe out the entire feature because you think it cannot be added to maven projects... or because "it's
not a jar"!
Comment 4 Trey Spiva 2008-12-17 17:59:54 UTC
I am assigning this issue to the web services team to make verify if the Calculator sample needs to be updated for 6.5.
Comment 5 Vince Kraemer 2008-12-17 19:59:56 UTC
The relevant tutorial is this one: http://www.netbeans.org/kb/60/websvc/wsit.html

There is NO dependency between the two projects... in the 'classic' sense (project B uses classes defined in project A)...

And there are no instructions to link the two projects together in the tutorial.

The Client project opens with a compilation error because none of the projects have the class 'CalculatorWSService'.. at
least initially.  That class is generated by the ws processing.

I did some other futzing with this issue to see what might be contributing to this change between 6.1 and 6.5.  here is
what I did.

1. I built a recent pull of the NB trunk.
1.5 I started this IDE against a new userdir.
2. I registered a GF v2ur2 domain.
3. I created the calculator project 'pair'
   The calculator project opens 'clean'
   the calculator client project opens with a flagged error.
4. I turn off the 'deploy on save' feature of the CalculatorClientApp project.
   [select project, right click, Properties... select Run from the left navigation tree... and uncheck 'Deploy on Save'
   Note: the app still shows an error flag, since there is NO file called CalculatorWSService.java in either project...
5. I close the IDE.
6. I restart the IDE.
   The CalculatorClientApp is still flagged as 'broken'....
7. I deploy the calculator project onto the v2 ur 2 domain.
8. I clean and build the calculator client app project.
   The project compiles clean. after a bit of 'scanning' the error badge gets removed from the project.
9. I deploy the CalculatorClientApp project onto the v2ur2 domain.
10. I open the browser and execute the client app.
  It executes correctly.

You will note: I NEVER had to define a dependency between the two projects...  That 'dependency' is defined by the
reference to the web service...

So... there is something broken is this use-case...

the sample opens and appears to be broken 'out-of-the-box'... it should not.  this is especially true since there is no
mention of 'initial brokenness' in the tutorial for 6.0/6.1... I opened issue 155700 to track this a bit easier.

I am going to close this issue as invalid at this point... the 'feature' (let a war depend on another war) should not be
enabled... because it is not useful... and did not exist.
Comment 6 Vince Kraemer 2008-12-17 20:00:41 UTC
forgot to close