Re: Need suggestions...

2003-07-16 Thread did
I trieds, using b10, to put my tld into src/conf/META-INF/

However the tld is not included into the Jar.

I use in my project.xml the following setup:
!-- build information for the project --
build
sourceDirectorysrc/main/java/sourceDirectory
unitTestSourceDirectorysrc/test/java/unitTestSourceDirectory
unitTest
resources
resource
directorysrc/test/java/directory
includesinclude**/*/include /includes
excludesexclude**/*.java/exclude /excludes
/resource
/resources
includes
include**/*Test.java/include
/includes
/unitTest
resources
resource
directorysrc/conf/directory
includes
include*.properties/include
include*.tld/include
/includes
/resource
/resources
/build
But got no tld on my jar. Only:
0 Thu Jul 17 02:51:18 CEST 2003 META-INF/
430 Thu Jul 17 02:51:16 CEST 2003 META-INF/MANIFEST.MF
0 Thu Jul 10 22:22:14 CEST 2003 META-INF/LICENSE.txt
279 Thu Jul 17 02:51:16 CEST 2003 META-INF/INDEX.LIST
Any idea?

Thx,
Did.
Brian Ewins wrote:

did wrote:

Hi all,

We are developping a JSP taglib project. In this project we would 
like to provide the following artifacts:

- The taglib jar
- The Tld definition file
- A sample web site demonstrating the lib features. (A War containing 
the some extra java classes + the taglib jar + JSP resources)

How can I drive Maven to generate 2 Artifacts (the jar and the demo 
war) ?
What is the ideal directory layout?
What is the related project.xml configuration?

I thought of something like:

src\
src\conf\file.tld
src\java\com.myproject
src\webapp\WEB-INF\...
src\samples\com.myproject.samples


src\
src\conf\META-INF\taglib.tld
src\main\com\myproject
JSP taglibs are designed so that if the tld is in the jar's META-INF, 
you don't need to distribute it separately, or declare it in your 
web.xml. In JSP 1.2 + 2.0, any .tld in META-INF is recognized this 
way, but in older JSP 1.1 systems only 'META-INF/taglib.tld' is 
recognized. Best practice is therefore to name your taglib as shown 
above.

Distributing the tld in the jar is definitely the way to go as you 
guarantee that your jar and tld are in sync, and simplifies use of the 
taglib - no web.xml hacking. To use it just make sure that when you do:
[EMAIL PROTECTED] prefix=foo uri=http://some/uri/i/just/made/up%
in your JSP, the uri must match the uri in your TLD file. Best 
practice is to use the same URI for every version of your taglib, so 
that clients can drop a new version into their webapp without editing 
any files.

I used 'main' not 'java' for the source dir above; you'll notice a lot 
of the plugins are now written that way. The point is that if you have 
e.g. 'java', 'test', 'webapp' - then 'test' contains java as well; and 
why would 'webapp' not be called 'jsp' or 'velocity'. 'main' is a 
slightly better description. This isnt a hard  fast rule though, just 
a suggestion.

You should also consider using xdoclet to generate your tld.

Does it makes sense?

Also notes I would not like to create 2 different projects with a 
reactor because the final artifact is just the Jar. The War is only 
for a demo and I think we should not distribute it in a binary 
repository. ... However

I could go on to describe how to get this jar included in your demo 
webapp (a postGoal of war:webapp would be the way to go in b10, plus 
code to compile your 'extra' classes...) but frankly it is a lot 
easier to do with two projects and the reactor[1]. Don't fight what 
works.

Its also useful to use the demo project for testing, e.g. using 
Cactus. Your setup will become horrendously complex if you try to do 
this while still working around generating the second artifact.

Hope this helps

-Baz


Thanks for your help and for this great tools that is Maven!
Didier.


[1] it would be a little simpler if war:webapp built wars using the 
jar rather than the separate classes; but thats not how it works. You 
can also make building a demo webapp simpler if you keep the tld in 
the .war, not the .jar - all your 'preGoal' would need to do then is 
compile the extra code. But while this second approach makes building 
your demo app easier, it makes using/distributing your taglib harder. 
Whats more, the demo wouldn't be demoing the taglib as people would 
actually use it, i.e. by having the jar in the webapp, since it has 
the expanded classes.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Need suggestions...

2003-07-11 Thread Brian Ewins
did wrote:

Hi all,

We are developping a JSP taglib project. In this project we would like 
to provide the following artifacts:

- The taglib jar
- The Tld definition file
- A sample web site demonstrating the lib features. (A War containing 
the some extra java classes + the taglib jar + JSP resources)

How can I drive Maven to generate 2 Artifacts (the jar and the demo war) ?
What is the ideal directory layout?
What is the related project.xml configuration?
I thought of something like:

src\
src\conf\file.tld
src\java\com.myproject
src\webapp\WEB-INF\...
src\samples\com.myproject.samples
src\
src\conf\META-INF\taglib.tld
src\main\com\myproject
JSP taglibs are designed so that if the tld is in the jar's META-INF, 
you don't need to distribute it separately, or declare it in your 
web.xml. In JSP 1.2 + 2.0, any .tld in META-INF is recognized this way, 
but in older JSP 1.1 systems only 'META-INF/taglib.tld' is recognized. 
Best practice is therefore to name your taglib as shown above.

Distributing the tld in the jar is definitely the way to go as you 
guarantee that your jar and tld are in sync, and simplifies use of the 
taglib - no web.xml hacking. To use it just make sure that when you do:
[EMAIL PROTECTED] prefix=foo uri=http://some/uri/i/just/made/up%
in your JSP, the uri must match the uri in your TLD file. Best practice 
is to use the same URI for every version of your taglib, so that clients 
can drop a new version into their webapp without editing any files.

I used 'main' not 'java' for the source dir above; you'll notice a lot 
of the plugins are now written that way. The point is that if you have 
e.g. 'java', 'test', 'webapp' - then 'test' contains java as well; and 
why would 'webapp' not be called 'jsp' or 'velocity'. 'main' is a 
slightly better description. This isnt a hard  fast rule though, just a 
suggestion.

You should also consider using xdoclet to generate your tld.

Does it makes sense?

Also notes I would not like to create 2 different projects with a 
reactor because the final artifact is just the Jar. The War is only for 
a demo and I think we should not distribute it in a binary repository. 
... However

I could go on to describe how to get this jar included in your demo 
webapp (a postGoal of war:webapp would be the way to go in b10, plus 
code to compile your 'extra' classes...) but frankly it is a lot easier 
to do with two projects and the reactor[1]. Don't fight what works.

Its also useful to use the demo project for testing, e.g. using Cactus. 
Your setup will become horrendously complex if you try to do this while 
still working around generating the second artifact.

Hope this helps

-Baz


Thanks for your help and for this great tools that is Maven!
Didier.
[1] it would be a little simpler if war:webapp built wars using the jar 
rather than the separate classes; but thats not how it works. You can 
also make building a demo webapp simpler if you keep the tld in the 
.war, not the .jar - all your 'preGoal' would need to do then is compile 
the extra code. But while this second approach makes building your demo 
app easier, it makes using/distributing your taglib harder. Whats more, 
the demo wouldn't be demoing the taglib as people would actually use it, 
i.e. by having the jar in the webapp, since it has the expanded classes.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]