1 |
Dylan --- |
2 |
|
3 |
Thanks for the reply. I'm still new to Java development and trying |
4 |
to sort out how it fits into portage and gentoo, so your |
5 |
explanations (and patience) are appreciated. More comments |
6 |
interspersed below. |
7 |
|
8 |
Dylan Carlson wrote: |
9 |
> -----BEGIN PGP SIGNED MESSAGE----- |
10 |
> Hash: SHA1 |
11 |
> |
12 |
> Greetings Dwight, |
13 |
> |
14 |
> On Sun June 15 2003 5:31 pm, D. Tuinstra wrote: |
15 |
>> 1) Should there be a virtual for servlet containers? At present |
16 |
>> there are several containers available including tomcat, jetty, |
17 |
>> and jboss (and that's just open source). I've only worked with |
18 |
>> tomcat, but some of the references I've read say that each |
19 |
>> servlet container has its own directory structure and its own way |
20 |
>> to install servlet-based webapps. When writing an ebuild for a |
21 |
>> webapp it would be nice to know, in a standard way, whether a |
22 |
>> container is available and if so, which. |
23 |
> |
24 |
> Since the servlet 2.2 API spec, WAR files have a standard |
25 |
> structure and this is used by all current versions of |
26 |
> 2.2-compliant servlet containers I'm aware of. |
27 |
|
28 |
OK, good. |
29 |
|
30 |
> Some packages build WAR files that are entirely optional to the |
31 |
> set of |
32 |
> classes that the package provides. For this reason and others, it |
33 |
> doesn't make sense (from my perspective) to have an ebuild |
34 |
> automatically deploy a |
35 |
> WAR. In doing so, it could have potential security issues ... |
36 |
> especially on a server that is already running stuff live. |
37 |
> |
38 |
> Since the installation of a WAR is typically just a matter of |
39 |
> copying the file in, and maybe touching a config file or two -- |
40 |
> WARs should be installed into: |
41 |
> |
42 |
> /usr/share/${PN}/war/ |
43 |
> ...or |
44 |
> /usr/share/${PN}-${PV}/war/ for slotted apps |
45 |
> |
46 |
> I would like to keep a distinct line between installing a package |
47 |
> and |
48 |
> deploying it. If the user wants to deploy the application, it |
49 |
> has to be a separate action; no different than adding a script in |
50 |
> /etc/init.d to a given runlevel. |
51 |
> |
52 |
|
53 |
This makes good sense. Perhaps (as a style convention) such ebuilds |
54 |
should have an info message reminding the user that deployment is |
55 |
still necessary as as a separate step, and mention any tools gentoo |
56 |
provides to assist with this (such as the WAR addition to |
57 |
java-config you mention below). |
58 |
|
59 |
I will follow the suggestion for installing WAR-containing packages. |
60 |
I'd also thought there might be some justification for putting them |
61 |
in /opt, but if one considers /opt for pre-compiled packages meant |
62 |
to be run by users found in /etc/passwd, then webapps don't fit the |
63 |
bill. |
64 |
|
65 |
> Adding support to java-config, supposing a virtual exists for |
66 |
> servlet containers, is the ideal solution to installing WAR files |
67 |
> in the long-term. Part of that will be some way of coupling WAR |
68 |
> deployment and any |
69 |
> corresponding config files in the same feature. Currently |
70 |
> java-config is undergoing a rewrite, so between Todd Berman and |
71 |
> myself finishing that up, expect to see that sometime soon. |
72 |
|
73 |
Great! |
74 |
|
75 |
> Either way, I don't expect to support non-WAR servlet packages as |
76 |
> there's |
77 |
> just much that can go wrong. Those types of packages will be put |
78 |
> in /usr/share/${PN}/ until they can be installed as WARs, in which |
79 |
> case the user will have to install them manually (not via |
80 |
> java-config). |
81 |
|
82 |
I suppose also that a sufficiently motivated ebuild author could |
83 |
have the ebuild construct the WAR during the install() phase. One |
84 |
issue that will arise is what to do with pre-builts that have their |
85 |
own installer that wants to install a servlet container. I've |
86 |
noticed this with frameworks that include examples. I suppose this |
87 |
would require picking apart the provided jars and scripts and then |
88 |
putting things back together reasonably. Ugh. |
89 |
|
90 |
Case in point regarding non-WAR installs: struts. It's meant to be |
91 |
installed 755 as a bunch of jars. During development you're |
92 |
expected to put them on your classpath (either by appending to the |
93 |
classpath or by copying the appropriate jars to your development |
94 |
tree). During webapp deployment you're expected to have copies of |
95 |
the jars in your WAR. At least so it seems; I'm still trying to |
96 |
figure it out in my spare time. (I submitted an ebuild for struts |
97 |
to bugzilla a week or two back (#21930) but I think now it's |
98 |
probably not quite right --- flattens the file hierarchy a little |
99 |
too much). |
100 |
|
101 |
>> 2) Related question: what should the default container dependency |
102 |
>> be if none is installed? Tomcat? |
103 |
> |
104 |
> We'll have to pick one for a virtual. Tomcat is the official |
105 |
> reference implementation; also considering everything else Apache |
106 |
> produces, it makes overall sense for Tomcat to be the default. |
107 |
|
108 |
I'd agree. |
109 |
|
110 |
>> 3) Some Java tools, such as Struts Console, can be installed |
111 |
>> standalone or as a plugin to one or more Java IDE's. Should there |
112 |
>> be a USE variable for each of the IDE's, that an ebuild can |
113 |
>> consult to see which IDE's it should install itself into? If so, |
114 |
>> how would version dependency/compatability issues be handled? |
115 |
> |
116 |
> That's a complicated issue. It might make sense to make a plugin |
117 |
> a separate package (which depends on the main struts package for |
118 |
> the member classes). e.g., dev-util/eclipse-struts. |
119 |
> |
120 |
> Alternatively, the ebuild can check for the presence of another |
121 |
> package |
122 |
> during src_compile (which is somewhat ugly but it works). It |
123 |
> depends on the circumstances. |
124 |
> |
125 |
> Either one of those two scenarios is more preferable IMO, than |
126 |
> piling on |
127 |
> more USE flags- even local ones. Some may disagree with me, but |
128 |
> USE flags should be conservative and restricted to compile-time |
129 |
> options as much as possible. |
130 |
|
131 |
I'm not sure that "...-plugin" ebuilds are a good idea (unless the |
132 |
package is *only* a plugin). If struts-console is any indication, |
133 |
there's not much different that makes the standalone into a plugin. |
134 |
And if there are distinct plugin/standalone jars, they may be |
135 |
wrapped into the same tarball (or buildable from the same source |
136 |
tarball). In this case, separate ebuilds might double the |
137 |
maintenance burden and bloat the number of packages. |
138 |
|
139 |
OTOH, if IDE-specific jars or source are individually downloadable, |
140 |
"...-plugin" or even "...-plugin-IDEname" makes a lot of sense. |
141 |
There's also a huge advantage to separate "...-plugin[-IDEname]" |
142 |
ebuilds in that dependency issues are much easier. |
143 |
|
144 |
Where things might get sticky is if the package is built from |
145 |
source, and there are different build targets for standalone vs. |
146 |
IDE-A vs. IDE-B vs. etc. In that case it would seem you have to |
147 |
either build them all, employ USE flags, or check to see what's |
148 |
installed. |
149 |
|
150 |
Maybe the right approach is similar to the "install vs. deploy" |
151 |
idea: "install vs. integrate". If a unified plugin architecture is |
152 |
adopted it would make it possible to write an |
153 |
"integrate-java-plugin" tool that a user could run after emerging. |
154 |
Until then, the user could be pointed to whatever docs the package |
155 |
provides describing the integration procedure for supported IDEs. |
156 |
Those docs would hopefully point out version/IDE considerations |
157 |
(struts-console does this). The downside is that someone searching |
158 |
for plugins would have to do an "emerge -S plugin" instead of -s, |
159 |
and hope the ebuild author put "plugin" in the description. |
160 |
|
161 |
Regards, |
162 |
|
163 |
--Dwight |
164 |
|
165 |
|
166 |
|
167 |
-- |
168 |
gentoo-dev@g.o mailing list |