[opencms-dev] opencms 6 | where to put class files
Jonathan Woods
jonathan.woods at scintillance.com
Wed Mar 15 10:16:54 CET 2006
Panos - you (and Christian) may well be right. But the reason I stuff
things directly in the server's filesystem during development is because I
have an automated Eclipse/Ant script which builds the whole app, FTPs it to
my server then kicks off a local script to copy files over. When Java
classes or JSPs have changed and I want to try out the new versions, it
takes one mouse click and about 30 seconds to make them availalbe, which is
a whole lot better than having to faff around publishing things. Of course,
I have to use the 'full' approach once things are stable.
Jon
_____
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Panos Kavalagios
Sent: 15 March 2006 08:34
To: The OpenCms mailing list
Subject: Re: [opencms-dev] opencms 6 | where to put class files
Dear all,
Am I forgetting something? I totally disagree with your approach to
directly put your class files in the server's filesystem. Why to bother?
OpenCms will do it for you automatically when you publish your class file or
jar file and of course restart your servlet container (e.g. Tomcat). From
the OpenCms Module documentation:
-----------------
In case you either added the classes/folder and/or the lib/ folder on
module creation, these folders are additionally created:
/system/modules/org.opencms.mymodule/classes/com/opencms/mymodule/
/system/modules/org.opencms.mymodule/lib/
* Inside the classes/ subfolder, an entire subfolder structure with
the package name of your module is created. All subfolders of the classes/
subfolder and their contents will be exported to WEB-INF/classes/ when your
module is published. For example you could place a localization Java
resource bundle in the module subfolder
classes/org/opencms/mymodule/my.properties.
* In the lib/ subfolder you could place any Java archives (JAR) that
are to be shipped with your module. All contents of the lib/ subfolder will
be exported to WEB-INF/lib/ when your module is published.
-----------------
What are you going to do in case you want to distribute your module to
another OpenCms instance? You will have to provide an additional archive
with your class files and give detailed instructions where they should
placed. Isn't it more confusing than to give a single module zip file and
have OpenCms to take care for the rest? I've already developed a module
having in the classes folder property localisation files and all the classes
in a jar file inside the lib folder. I haven't faced a single hitch in the
whole development process.
Regards,
Panos
Jonathan Woods wrote:
Joachim -
The question is made more complicated by the status of your module. If
you're developing it from scratch, and just putting JSP, XSD, HTML and Java
(class) files underneath /system/modules in directories following the normal
OpenCms module structure, that's fine - but until you tell OpenCms
'officially' that it's a module, it won't put the /system/modules/<your
module name>/classes directory in the runtime classpath - so your classes
won't be found. Same goes for jar files in /system/modules/<your module
name>/lib.
I think the best way to develop your module is to put your class files in
<opencms root>/WEB-INF/classes, which is always in the OpenCms classpath;
then once things are stable and you are ready to package up your module as a
module, you can put them instead in the directory above. Other people may
have different ways of working.
Tip: beware old versions of your classes being picked up from odd places.
I'd suggest including a build timestamp in your Java code and spitting it
out in the log or in a test area of your web pages, just so you can be sure
new stuff is being picked up; and of course if OpenCms has already loaded a
class then you'll need to restart Tomcat for it to pick up any new version.
Jon
_____
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Panos Kavalagios
Sent: 14 March 2006 15:48
To: The OpenCms mailing list
Subject: Re: [opencms-dev] opencms 6 | where to put class files
Joachim,
You can either place your class file in:
my.mod.submodule/classes/my/mod/submodule
or as a jar file in:
my.mod.submodule/lib
Regards,
Panos
Joachim Zittmayr wrote:
hello ocms.dev.list!
where do i have to put (new) class files?
can i put them just under a module classes folder (e.g.
my.mod.submodule/classes/classname.class)?
what else do i have to consider? it seems as if the newly created class
is not "recognized". i added a method, but i can't use it in a e.g.
jsp-template (method foo(String) is undefined for the type bar)
thanks 4 ur help!
joachim
--
Panagiotis Th. Kavalagios
Electrical & Computer Engineer
European Dynamics S.A.
Athens, Hellas
Tel: +30-210-8094500
_____
_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev
--
Panagiotis Th. Kavalagios
Electrical & Computer Engineer
European Dynamics S.A.
Athens, Hellas
Tel: +30-210-8094500
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060315/682df31d/attachment.htm>
More information about the opencms-dev
mailing list