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 54570 - Library is not jared on deployment
Summary: Library is not jared on deployment
Status: CLOSED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Infrastructure (show other bugs)
Version: 4.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Marek Fukala
URL:
Keywords:
Depends on: 50676 56420
Blocks:
  Show dependency tree
 
Reported: 2005-02-04 19:35 UTC by _ proxity
Modified: 2006-03-24 10:12 UTC (History)
0 users

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 _ proxity 2005-02-04 19:35:54 UTC
How to reproduce:

1. Create a webapp
2. Use the Library Manager to create a "Class
Library": in the Classpath tab add a folder and
not a JAR. I added a dir which contained a
com/foo/bar/ hierarchy.
3. Add this Class Library to the Compilation
classpath of the project in
Project Properties/Build/Compiling Sources

You will see that compilation works. This meas you
can import com.foo.bar and use the classes in the
added library.

Now try to run the webapp. You'll see that the
used classes of the lib are not found BECAUSE
your deployment puts the com/foo/bar/ hierarchy in
/WEB-INF/lib which does not work, becuase tomcat
only loads JARs from this directory!

A fix would be to copy com/foo/bar/ instead to
/WEB-INF/classes where tomcat accepts those
hierarchies. Or JAR them together before putting
them in /WEB-INF/lib.
Comment 1 Pavel Buzek 2005-02-17 02:19:01 UTC
I agree this is a problem. Not sure I will be able to solve it as
suggested. A library can consist of a mix of jar files and folders. I
will have to implement parsing of library path (see 50676) and maybe
then I can test if each entry is a file or jar and generate zip (or
copy to classpath).
Comment 2 zikmund 2005-03-15 11:14:28 UTC
See issue 56420 for similar problem with Folders on classpath.
Comment 3 Marek Fukala 2005-03-16 16:21:27 UTC
fixed the problem with libraries containing folders. 

Now when there is at least one folder in a library a
<path-in-war-classes>WEB-INF/classes</path-in-war-classes> element is created
under the library element in project.xml and then the buildscript copies all
directories into this location.

Checking in classpath/ClassPathSupport.java;
/cvs/web/project/src/org/netbeans/modules/web/project/classpath/ClassPathSupport.java,v
 <--  ClassPathSupport.java
new revision: 1.9; previous revision: 1.8
done
Checking in resources/build-impl.xsl;
/cvs/web/project/src/org/netbeans/modules/web/project/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.87; previous revision: 1.86
done
Comment 4 _ proxity 2005-03-16 17:18:16 UTC
Can you put it in the Update Center?
Comment 5 zikmund 2005-03-16 17:33:20 UTC
It will be in next published daily build (in couple of days).
We don't plan to put it on Update Center - Update Center is for finished
releases and 4.1 is not finished yet.
Comment 6 Pavel Buzek 2005-03-17 06:06:11 UTC
Marku, I see 2 problems with the way you solved this.

First, there is a regression - you cannot package additional content into
another folder, it always ends up in WEB-INF/classes.

Second, path-in-war-classes is not in xml schema for web project. I do not
understand why you need this tag. The correct solution would be test the
combination when you are in web-module-libraries tag and you have a folder to
copy - then copy it into WEB-INF/classes.
Comment 7 Marek Fukala 2005-03-17 09:26:26 UTC
Pavle, I admin that introducing the <path-in-war-classes> tag wasn't the best
idea, I just wanted to be consistent with <path-in-war> and didn't want to
hardcode WEB-INF/classes into the buildscript. Now when I thought through deeply
I must agree with you - I will remove it and hardcode the WEB-INF/classes into
the script. Sometimes less is more ;-)

As for the regression, I cannot reproduce - it works for me. Whatever I fill in
the path in war in the project customizre is copied there. Nevermind, I will
rewrite the code anyway.

I appreciate your comments Pavle. Thanks.
Comment 8 Pavel Buzek 2005-03-17 13:24:48 UTC
to make sure I made myself clear, the regression is (at least what I see):
1. create a web project (X)
2. create a library (Y), add a jar file and a non empty folder
3. open project X's properties, goto Build | Packaging, Add Library Y, set Path
in War to 'aaa'
4. Build the project, what I see is that the jar file in Y is copied into
web\aaa but the content of the folder in Y gets copied into WEB-INF/classes

If this works for you can QE confirm it also works for them? Thanks.
Comment 9 Marek Fukala 2005-03-17 13:59:42 UTC
I reverted the changes done to ClassPathSupport and build-impl.xml and fixed in
again only in build-impl.xml. Now it should be OK. I had a very bad day
yesterday :-). I am sorry for the complications.

Now both folders directly added to compilation libraries and folders within a
user defined library are copied into WEB-INF/classes. The additional content
libraries are not affected at all - they are always copied into location defined
in path-in-war.

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

The fix is only one line fix :-) See the diff:

849c849
<                             <xsl:with-param name="target"
select="concat('${build.web.dir.real}/',$copyto)"/>
---
>                             <xsl:with-param name="target"
select="concat('${build.web.dir.real}/','WEB-INF/classes')"/>
Comment 10 zikmund 2005-03-18 15:35:15 UTC
Verified in build 200503172015.