-
1. Re: configuring dev vs. prod modes for builds
gonorrhea Mar 25, 2009 5:47 PM (in response to gonorrhea)DAllen sheds some light:
A majority of your time working in the view will be spent developing JSF pages. You certainly want those changes to be picked up as well. If you’re using JSP for your JSF pages, you’re already covered. However, projects created by seam-gen use Facelets as the JSF view technology. Facelets will not read a view template more than one time unless it’s running in development mode. This mode is the complement to runtime JSP compilation. To enable development mode, you just need to ensure that the build- <profile>.properties file for your profile has the debug property set to true: debug=true When the build is run, this property will be applied to the web.xml descriptor, setting the facelets.DEVELOPMENT servlet context parameter in the web.xml descriptor to true:
<context-param> <param-name>facelets.DEVELOPMENT</param-name> <param-value>true</param-value> </context-param>
So how does this work if I don't have a variable for my facelets.DEVELOPMENT param-value?
-
2. Re: configuring dev vs. prod modes for builds
joblini Mar 25, 2009 10:52 PM (in response to gonorrhea)Hi Ron,
Why not make it a variable, for example @debug@, then in build.xml
<filterset> <filter token="debug" value="${debug}" /> </filterset>
-
3. Re: configuring dev vs. prod modes for builds
gonorrhea Mar 25, 2009 11:27 PM (in response to gonorrhea)
Ingo Jobling wrote on Mar 25, 2009 22:52:
Hi Ron,
Why not make it a variable, for example @debug@, then in build.xml<filterset> <filter token="debug" value="${debug}" /> </filterset>
Hey thx a lot for the reply. From your idea I found section 12.4 Customizing web apps in the Java Development with Ant book which is very helpful as well.
You can literally uncomment code in web.xml with the example in the book...
This is their solution in the build.xml:
<copy todir="build/WEB-INF" file="web/WEB-INF/web.xml" overwrite="yes"> <filterset> <filter token="start.cactus.config" value="-->"> <filter token="end.cactus.config" value="<!--" </filterset> </copy>
-
4. Re: configuring dev vs. prod modes for builds
gonorrhea Mar 26, 2009 12:30 AM (in response to gonorrhea)Well I tried incorporating this into my build.xml for the war target:
<copy todir="${war.dir}/WEB-INF" file="${basedir}/resources/WEB-INF/web.xml" overwrite="yes"> <filterset> <filter token="facelets-debug" value="${debug}"/> </filterset> </copy>
in addition to this in the web.xml:
<context-param> <param-name>facelets.DEVELOPMENT</param-name> <param-value>@facelets-debug@</param-value> </context-param>
And now the following folder is read-only:
\exploded-archives\BETS.war\WEB-INF
and I am getting this build error when I run 'ant clean':
C:\java\projects\BETS\build.xml:284: Unable to delete file C:\java\projects\BETS\exploded-archives\BETS.war\WEB-INF
very strange. I closed JBDS and windows explorer and I still can't manually delete the WEB-INF folder...
-
5. Re: configuring dev vs. prod modes for builds
gonorrhea Mar 26, 2009 12:31 AM (in response to gonorrhea)WEB-INF is not accessible. access is denied.
-
6. Re: configuring dev vs. prod modes for builds
gonorrhea Mar 26, 2009 5:37 PM (in response to gonorrhea)so that access problem seems to have been an anomaly.
I found the following tip in Seam in Action for components.properties:
debug=#{facesContext.externalContext.request.serverName eq 'localhost'}
Is it possible to use EL in web.xml?
e.g.:
<context-param> <param-name>facelets.DEVELOPMENT</param-name> <param-value>#{facesContext.externalContext.request.serverName eq 'localhost'}</param-value> </context-param>
-
7. Re: configuring dev vs. prod modes for builds
gonorrhea Mar 26, 2009 5:46 PM (in response to gonorrhea)I just ran 'ant clean war' for my seam-gen'd project.
Here is the original tokenized line from components.xml:
<core:init debug="@debug@" jndi-pattern="@jndiPattern@"/>
and here is the resulting components.xml after the successful build:
<core:init debug="true" jndi-pattern="BETS/#{ejbName}/local"/>
and the components.properties:
jndiPattern \#{ejbName}/local debug=#{facesContext.externalContext.request.serverName eq 'localhost'}
how/when during the build process do the tokenized variables (debug and jndiPattern) get replaced? 'components' is not referenced in my build.xml...
-
8. Re: configuring dev vs. prod modes for builds
gonorrhea Mar 26, 2009 5:49 PM (in response to gonorrhea)ok so according to new Yuan book:
You may notice that the seam-gen project uses a wildcard attribute to determine the value of the debug attribute:<core:init debug="@debug@"/>
Wildcard values are determine at runtime based on teh settings in a components.properties file definition.If this is true, then why are my wildcard/tokenized values already replaced right after 'ant war' is run???
-
9. Re: configuring dev vs. prod modes for builds
gonorrhea Mar 26, 2009 5:52 PM (in response to gonorrhea)I reproduced the locked folder behavior again when I run 'ant clean':
Buildfile: C:\java\projects\BETS\build.xml [echo] jboss.home = C:/java/jboss-eap-4.3/jboss-as [echo] ant.home = C:\java\jbdevstudio-2.0.0.CR2\eclipse\plugins\org.apache.ant_1.7.0.v200803061910 clean: [delete] Deleting directory C:\java\projects\BETS\exploded-archives\BETS.war BUILD FAILED C:\java\projects\BETS\build.xml:314: Unable to delete directory C:\java\projects\BETS\exploded-archives\BETS.war Total time: 359 milliseconds
-
10. Re: configuring dev vs. prod modes for builds
gonorrhea Mar 26, 2009 7:29 PM (in response to gonorrhea)I don't see a components.properties file in my ant explode EAR distro... ???
-
11. Re: configuring dev vs. prod modes for builds
joblini Mar 27, 2009 2:11 AM (in response to gonorrhea)Are you stopping the server (Jboss) when you do clean build?
-
12. Re: configuring dev vs. prod modes for builds
swd847 Mar 27, 2009 2:27 AM (in response to gonorrhea)The seam components.properties substitution uses the same format as ant substitutions, which can be confusing.
I use settings in build.properties and deploy.properties:
build.properties:
build.development=true
deploy.properties:
deploy.development=true
build.xml:
<condition property="project.development"> <equals arg1="${build.development}" arg2="true" /> </condition> ---------- <filter filtersfile="deploy.properties"/> --------- <copy todir="${ear.dir}/lib"> <fileset dir="${lib.dir}/warlib"> <include name="jboss-seam-debug.jar" if="project.development" /> </fileset> </copy> --------- <copy todir="${war.dir}/WEB-INF" filtering="true"> <fileset dir="${basedir}/resources/war/main/WEB-INF"> <include name="*.*" /> </fileset> </copy>
web.xml:
<context-param> <param-name>facelets.DEVELOPMENT</param-name> <param-value>@deploy.development@</param-value> </context-param>
There are cleaner ways of doing this I think, but this works for me so I have not looked into it further.
-
13. Re: configuring dev vs. prod modes for builds
gonorrhea Mar 27, 2009 9:14 PM (in response to gonorrhea)
Ingo Jobling wrote on Mar 27, 2009 02:11:
Are you stopping the server (Jboss) when you do clean build?No. I never do that when in dev/test cycle with 'ant explode' or 'ant restart'. So i guess the JVM/JBoss process is locking it then...
-
14. Re: configuring dev vs. prod modes for builds
gonorrhea Mar 27, 2009 10:02 PM (in response to gonorrhea)I stopped the server. I ran 'ant clean'. result:
Buildfile: C:\java\projects\BETS\build.xml
[taskdef] Could not load definitions from resource svntask.properties. It could not be found.
clean:
[delete] Deleting directory C:\java\projects\BETS\exploded-archives\BETS.war
BUILD FAILED
C:\java\projects\BETS\build.xml:342: Unable to delete directory C:\java\projects\BETS\exploded-archives\BETS.war
Total time: 359 milliseconds
I noticed that the foo-WAR\WEB-INF folder is read-only and I can't uncheck that permanently (it's read-only when I view folder properties later). when i delete that WEB-INF folder from windows explorer, I can then run 'ant clean' successfully.