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 207682 - Classpath is not set intuitively for JAX-RS in Maven projects
Summary: Classpath is not set intuitively for JAX-RS in Maven projects
Status: RESOLVED DUPLICATE of bug 206529
Alias: None
Product: webservices
Classification: Unclassified
Component: REST (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal (vote)
Assignee: Denis Anisimov
URL:
Keywords:
Depends on: 206529
Blocks:
  Show dependency tree
 
Reported: 2012-01-24 13:07 UTC by Petr Jiricka
Modified: 2012-04-04 12:42 UTC (History)
2 users (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 Petr Jiricka 2012-01-24 13:07:17 UTC
1. Create a Maven Java EE 6 web project (I used GlassFish 3.1.2 target)
2. Create a new REST service from patterns
3. You will get a dialog which allows you to add Jersey to the project with 3 possibilities:
- Do not add (checkbox unchecked): only the Java EE 6 API will be on the classpath with provided scope
- Add, use server-bundled Jersey: only the Java EE 6 API will be on the classpath with provided scope
- Add, use IDE-bundled Jersey: also the Jersey jars will be added with normal scope

I would expect that there will be some difference between first and second case - currently they behave the same. Shouldn't in the second case Jersey jars be added with provided scope?

Next, in the third case, Jackson jars are not added to CP, although they are a part of Jersey. This is inconsistent with the Ant web project, which adds also Jackson jars in this case.
Comment 1 Denis Anisimov 2012-01-24 13:26:43 UTC
(In reply to comment #0)
> 1. Create a Maven Java EE 6 web project (I used GlassFish 3.1.2 target)
> 2. Create a new REST service from patterns
> 3. You will get a dialog which allows you to add Jersey to the project with 3
> possibilities:
> - Do not add (checkbox unchecked): only the Java EE 6 API will be on the
> classpath with provided scope
> - Add, use server-bundled Jersey: only the Java EE 6 API will be on the
> classpath with provided scope
> - Add, use IDE-bundled Jersey: also the Jersey jars will be added with normal
> scope
> 
> I would expect that there will be some difference between first and second case
> - currently they behave the same. Shouldn't in the second case Jersey jars be
> added with provided scope?
In JEE6 profile case 1) and 2) behaves the same ( this is not a Maven 
specific issue, it is general issue).
There is no need to add Jersey classpath into the projects classpath because 
Jersey  already is a part of server classpath.
The only thing which could be improved here :
remove the second option at all for JEE6 profile.
As result there will be just CheckBox : Use NB bundled Jersey.
( The JEE5 case only )
> 
> Next, in the third case, Jackson jars are not added to CP, although they are a
> part of Jersey. This is inconsistent with the Ant web project, which adds also
> Jackson jars in this case.
This could be a Maven area issue .
Comment 2 Petr Jiricka 2012-01-24 14:21:00 UTC
> As result there will be just CheckBox : Use NB bundled Jersey.

Sounds good, I think this is a good solution.

> This could be a Maven area issue .

No, looking at websvc.restlib/src/org/netbeans/modules/websvc/swdp/swdp.xml, there is a mismatch between the classpath volume and the maven-pom volume. These two volumes should match - currently Jackson is included in classpath, but not in maven-pom. Cc'ing also Jakub - he probably knows what's the best place to get the correct list of Maven poms for Jersey.
Comment 3 Denis Anisimov 2012-01-24 14:44:18 UTC
(In reply to comment #2)
> > As result there will be just CheckBox : Use NB bundled Jersey.
> 
> Sounds good, I think this is a good solution.
> 

Actually this is straightforward solution for current state only .
I would like to find a solution for the issue #206529 before do this.
We can decide that the latter issue should not be resolved  at all, resolved as
suggested ( add most Jersey related jars into server classpath ) and 
there could be a different decision:
server classpath could be divided onto two type classpathes. One part is 
the "static" classpath ( with the same behavior as now , f.e. only JEE6 related classes). The other part is "dynamic" classpath. The second part is related to the project. 
It shouldn't be included into the resulting deployment unit. So it behaves as server classpath.
On the other hand it should contain additional jars bundled with the  server.
There should be an API that allows to modify this classpath.
Such solution will allows to us to solve issue #206529 in general way.
In case such feature is available the current UI with 3 option can be kept:
1) Do not modify classpath at all.
2) Add all Jersey related jars from server classpath into the project classpath
( those jars will be added into the second part of server classpath not project
 classpath actually ).
3) Add NB bundled Jersey.

This is just a proposition and we can deny it.
But even with JEE6 profile current UI have sense with such feature .
Comment 4 Denis Anisimov 2012-04-04 12:09:46 UTC
There are several items in the issue:
- Classpath is not extended in case Server bundled Jersey is used.
That's as I said is not Maven specific issue. It's a common behavior. As we 
discussed there is a sense in "Server bundled Jersey" for JEE6 server profile :
project should be extended with Jersey jars in the specific classpath ( the libraries shouldn't be added in the deployment unit but they should be available in the project's classpath). Currently it is not possible to do. It will be 
implemented when special classpath type will be available.
- Jeckson jars issue.
I'm  not able to reproduce it with 7.2. 
Project classpath contains all four jackson jars :
jackson-core-asl-1.7.1
jackson-jaxrs-1.7.1
jackson-mapper-asl-1.7.1
jackson-xc-1.7.1
Comment 5 Petr Jiricka 2012-04-04 12:42:26 UTC
Agree we can close this, but IMO it should be a duplicate of 206529 rather than WONTFIX.

*** This bug has been marked as a duplicate of bug 206529 ***