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 198361 - Empty <includes/> on Maven JAX-WS client project
Summary: Empty <includes/> on Maven JAX-WS client project
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on: 195928
Blocks:
  Show dependency tree
 
Reported: 2011-05-05 21:39 UTC by emiddio
Modified: 2011-05-11 19:38 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
shows wrong nodes at left of image (230.63 KB, image/jpeg)
2011-05-05 21:39 UTC, emiddio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description emiddio 2011-05-05 21:39:14 UTC
simple (default ide generated)maven jaxws client reports wrong
package structure for project/other-nodes element

see attached jpeg
Comment 1 emiddio 2011-05-05 21:39:53 UTC
Created attachment 108140 [details]
shows wrong nodes at left of image
Comment 2 Jesse Glick 2011-05-06 11:59:03 UTC
(In reply to comment #0)
> simple (default ide generated) maven jaxws client

I am not sure precisely what the reporter means by this - which wizard(s) were run? - but anyway I did find the MavenCalculatorClient sample project which exhibits the problem. In that case there are two issues:

1. The initial POM just has an empty <includes/> tag, which is nonsense and results in the entire source tree being copied into target/classes/META-INF/! I do not know much about JAX-WS but I guess what was intended was

        <resources>
            <resource>
                <targetPath>META-INF</targetPath>
                <directory>src</directory>
                <includes>
                    <include>jax-ws-catalog.xml</include>
                    <include>wsdl/</include>
                </includes>
            </resource>
        </resources>

2. Bug #195928 causes a spurious error badge to appear on the project.
Comment 3 Jesse Glick 2011-05-06 11:59:31 UTC
Reassigning for #1.
Comment 4 Denis Anisimov 2011-05-06 12:33:22 UTC
(In reply to comment #2)

> 
> 1. The initial POM just has an empty <includes/> tag, which is nonsense and
> results in the entire source tree being copied into target/classes/META-INF/! I
> do not know much about JAX-WS but I guess what was intended was
> 
>         <resources>
>             <resource>
>                 <targetPath>META-INF</targetPath>
>                 <directory>src</directory>
>                 <includes>
>                     <include>jax-ws-catalog.xml</include>
>                     <include>wsdl/</include>
>                 </includes>
>             </resource>
>         </resources>
> 

I think you are right about content of includes element.
But I'm not an expert in Maven . 
Does it really means that only jax-ws-catalog.xml file and wsdl catalog should be
included only ?
I'm asking it because the proposed change of the pm.xml file doesn't lead to 
some changes in the Project explorer.
Other sources node still contains the same wrong packages.
Is it some issue or something that I did wrong ?
Comment 5 Denis Anisimov 2011-05-06 12:34:15 UTC
Jesse, please help me with the latest comment.
Comment 6 Jesse Glick 2011-05-06 13:27:25 UTC
(In reply to comment #4)
> I think you are right about content of includes element.
> But I'm not an expert in Maven . 
> Does it really means that only jax-ws-catalog.xml file and wsdl catalog should
> be
> included only ?

That is up to the JAX-WS domain expert. Certainly src/main/ and src/test/ dirs should not be copied to target/classes/src/main/ and target/classes/src/test/, which is what happens now and is clearly a mistake.

> I'm asking it because the proposed change of the pm.xml file doesn't lead to 
> some changes in the Project explorer.
> Other sources node still contains the same wrong packages.
> Is it some issue or something that I did wrong ?

As I said in comment #2, that is a separate issue.
Comment 7 Denis Anisimov 2011-05-06 13:44:34 UTC
(In reply to comment #6)
> (In reply to comment #4)
> > I think you are right about content of includes element.
> > But I'm not an expert in Maven . 
> > Does it really means that only jax-ws-catalog.xml file and wsdl catalog should
> > be
> > included only ?
> 
> That is up to the JAX-WS domain expert. Certainly src/main/ and src/test/ dirs
> should not be copied to target/classes/src/main/ and target/classes/src/test/,
> which is what happens now and is clearly a mistake.
Yes sure.
But I've asked not from JAX-WS point of view but from Maven <includes> element presence/absnce.
( The next sentence is about it ).  
> 
> > I'm asking it because the proposed change of the pm.xml file doesn't lead to 
> > some changes in the Project explorer.
> > Other sources node still contains the same wrong packages.
> > Is it some issue or something that I did wrong ?
> 
> As I said in comment #2, that is a separate issue.
I missed this .
Thanks.
So this is the problem of Sample project only.
Empty "includes" element is not added by any other wizard except Sample 
Maven Calculator Client.
Comment 8 emiddio 2011-05-06 18:26:04 UTC
> simple (default ide generated) maven jaxws client

i created nb7 maven web project from scratch,
then add 1 webservice --which results in a default method/operation
added.

this project builds, deploys fine.

then -- after deployment of above, create ide generated maven
java project.

then using nb7 ide -- add webservice client, specify prev web project as
wsdl location;

then using nb7 insert-code in the main java class method -- call
the jaxws webservice operation.

project will build, run fine.

but exhibits the described/reported problem.
Comment 9 Denis Anisimov 2011-05-10 08:02:33 UTC
(In reply to comment #8)
> > simple (default ide generated) maven jaxws client
> 
> i created nb7 maven web project from scratch,
> then add 1 webservice --which results in a default method/operation
> added.
> 
> this project builds, deploys fine.
> 
> then -- after deployment of above, create ide generated maven
> java project.
> 
> then using nb7 ide -- add webservice client, specify prev web project as
> wsdl location;
> 
> then using nb7 insert-code in the main java class method -- call
> the jaxws webservice operation.
> 
> project will build, run fine.
> 
> but exhibits the described/reported problem.

I'm able to reproduce it exactly as described here.
NB adds "resources" element with empty "includes" right after WS client creation.

So there are two problems :
1) Correct Maven Sample project.
2) Correct pom.xml modification .
Comment 10 Denis Anisimov 2011-05-10 12:08:33 UTC
This issue is inside maven.model module.
There is a special code that handles situation exactly in the way as suggested :

 Resource res = model.getFactory().createResource();
            res.setTargetPath("META-INF"); //NOI18N
            res.setDirectory("src"); //NOI18N
            res.addInclude("jax-ws-catalog.xml"); //NOI18N
            res.addInclude("wsdl/**"); //NOI18N
            bld.addResource(res);

The code is inside org.netbeans.modules.maven.jaxws.MavenModelUtils.addWsdlResources() method.

But the res.addInclude() is badly implemented .
Its implementation is org.netbeans.modules.maven.model.pom.impl.ResourceImpl.addInclude().
The problem code is 
for (StringList list : lists) {
            if (getModel().getPOMQNames().INCLUDES.getName().equals(list.getPeer().getNodeName())) {
                list.addListChild(include);
                return;
            }
        }
The condition in the "if" is false because 
getModel().getPOMQNames().INCLUDES.getName() equals "includes"
but list.getPeer().getNodeName() contains prefix "pom" and equals 
"pom:includes".
QNames are compared via names and this is incorrect.
Probably there are a number of such incorrect code in the maven.model impl.
QNames should be compared by names AND namespace. Prefix should not be checked at all.

The Sample problem is consequence of incorrectly created project with described above issue. Maven model fix will not fix the sample project so I file different issue against JAX-WS client Sample.
Comment 11 Denis Anisimov 2011-05-10 12:12:45 UTC
See issue #198475 for MavenCalculatorClient client sample.
Comment 12 Jesse Glick 2011-05-11 01:02:45 UTC
(In reply to comment #10)
> getModel().getPOMQNames().INCLUDES.getName() equals "includes"
> but list.getPeer().getNodeName() contains prefix "pom" and equals 
> "pom:includes".

Reproduced according to instructions and also in a unit test. Surprisingly, seemingly identical code in ProjectImpl.addModule works fine. I am not sure, but I think the difference is that the ResourceImpl has a null parent field at the time that addInclude is called, and this somehow changes the way Element.getNodeName() (also getTagName) behaves.
Comment 13 Jesse Glick 2011-05-11 01:23:07 UTC
core-main #cf21b68973a0
Comment 14 Quality Engineering 2011-05-11 19:38:20 UTC
Integrated into 'main-golden', will be available in build *201105111436* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/cf21b68973a0
User: Jesse Glick <jglick@netbeans.org>
Log: #198361: Empty <includes/> on Maven JAX-WS client project