1 2 Previous Next 22 Replies Latest reply on Apr 1, 2009 8:21 AM by erimag Go to original post
      • 15. Re: configuring dev vs. prod modes for builds

        If this is true, then why are my wildcard/tokenized values already replaced right after 'ant war' is run???

        If you are using 2.0.2, this was a bug in that version of seam-gen, see:  JBSEAM-3031


        You can apply the patch from JBSEAM-3157 to your gen'd project which will resolve the issue and allow you to use profile-specific components.properties configurations (e.g. dev, prod, and test).  This is covered in the seam-gen chapter of the book when we discuss profiles.


        Hope that helps.

        • 16. Re: configuring dev vs. prod modes for builds
          gonorrhea

          had a file open that was in that directory structure.  closed file, ant clean ran fine.  I will test with AS running now...

          • 17. Re: configuring dev vs. prod modes for builds
            gonorrhea

            I have a build-gen ant script almost dev complete, documented and tested which handles all of this:


            <target name="build-gen" depends="buildsetup, clean" description="Interview build engineer, clean, checkout code from SVN, build/deploy, restart JBoss service, hit server, email distro">



            buildsetup target is the build-gen interview, similar to 'seam setup' questions with associated build-gen.properties file.


            it modifies the war target so that the tokenized value here is replaced:


             

            <context-param>
                  <param-name>facelets.DEVELOPMENT</param-name>
                  <param-value>@facelets-debug@</param-value>
               </context-param>



            it excludes jboss-seam-debug.jar if debug=true.


            when I tried posting the entire ant target's script, it crashed this site (com.mysql.jdbc.MySqlDataTruncation: data too long for column 'DESCRIPTION_VALUE')


            here's what it looks like at cmd line:


            C:\java\projects\BETS>ant -Dprofile=prod build-gen
            Buildfile: build.xml
            
            buildsetup:
                 [echo] Welcome to build-gen :-)
                [input] Enter your JBoss home directory [C:/jboss-eap-4.3/jboss-as] [C:/jbos
            s-eap-4.3/jboss-as]
            
                [input] Enter your JBoss service name to be re-started after deploy; leave b
            lank if you don't need re-start after deploy [JBoss-EAP-4.3.0] [JBoss-EAP-4.3.0]
            
            
                [input] Enter your debug setting ('true' or 'false' only) [true] [true]
            
                [input] Enter your profile setting [dev/prod] [dev] [dev]
            
                [input] Enter your deployment directory setting [c:\java\jboss-eap-4.3\jboss
            -as\server\default\deploy] [c:\java\jboss-eap-4.3\jboss-as\server\default\deploy
            ]
            
                [input] Enter the ant target to exec [deploy] [deploy]
            
                [input] Enter the ant target's property (as required) [] []
            
                [input] Enter the svn repos location (e.g. http://svn/repos/managed/_Sites/O
            RG/Applications/BETS) [http://svn/repos/managed/_Sites/ORG/Applications/BETS] [h
            ttp://svn/repos/managed/_Sites/ORG/Applications/BETS]
            
                [input] Enter the tag (build number) to build from [0.5.0.0] [0.5.0.0]
            
                [input] Enter the application's URL [http://localhost:8080/BETS]
            
                [input] Enter the mailhost (e.g. CORG0MS01.corp.cox.com) [CORG0MS01.corp.cox
            .com] to send followup email [CORG0MS01.corp.cox.com]
            
                [input] Enter your email address [arbi.sookazian@cox.com] [arbi.sookazian@co
            x.com]
            
                [input] Enter comma-separated list of recipients [arbi.sookazian@cox.com] [a
            rbi.sookazian@cox.com]
            
               [delete] Deleting: C:\java\projects\BETS\build-gen.properties
            [propertyfile] Creating new property file: C:\java\projects\BETS\build-gen.prope
            rties
            
            clean:
               [delete] Deleting directory C:\java\projects\BETS\dist
               [delete] Deleting directory C:\java\projects\BETS\exploded-archives\BETS.ear
               [delete] Deleting directory C:\java\projects\BETS\exploded-archives\BETS.war
               [delete] Deleting directory C:\java\projects\BETS\exploded-archives\BETS.jar
            
            build-gen:
            
            init:
                [mkdir] Created dir: C:\java\projects\BETS\exploded-archives\BETS.jar
                [mkdir] Created dir: C:\java\projects\BETS\exploded-archives\BETS.ear
                [mkdir] Created dir: C:\java\projects\BETS\exploded-archives\BETS.war
                [mkdir] Created dir: C:\java\projects\BETS\dist
            
            compile:
                [javac] Compiling 86 source files to C:\java\projects\BETS\exploded-archives
            \BETS.jar
                [javac] Note: C:\java\projects\BETS\src\dao\com\cox\bets\dao\StoredProcedure
            DAO.java uses or overrides a deprecated API.
                [javac] Note: Recompile with -Xlint:deprecation for details.
                [javac] Note: Some input files use unchecked or unsafe operations.
                [javac] Note: Recompile with -Xlint:unchecked for details.
            
            copyclasses:
            
            jar:
                 [copy] Copying 2 files to C:\java\projects\BETS\exploded-archives\BETS.jar
                 [copy] Copying 1 file to C:\java\projects\BETS\exploded-archives\BETS.jar\M
            ETA-INF
                 [copy] Copying 1 file to C:\java\projects\BETS\exploded-archives\BETS.jar\M
            ETA-INF
                 [copy] Copying 1 file to C:\java\projects\BETS\exploded-archives\BETS.jar
            
            war:
                 [copy] Copying 66 files to C:\java\projects\BETS\exploded-archives\BETS.war
            
                 [copy] Copied 7 empty directories to 1 empty directory under C:\java\projec
            ts\BETS\exploded-archives\BETS.war
                 [copy] Copying 1 file to C:\java\projects\BETS\exploded-archives\BETS.war\W
            EB-INF
                 [echo] in debug/jndiPattern filterset: debug = false
                 [copy] Copying 4 files to C:\java\projects\BETS\exploded-archives\BETS.war\
            WEB-INF
                 [copy] Copying 10 files to C:\java\projects\BETS\exploded-archives\BETS.war
            \WEB-INF\lib
                 [copy] Copying 5 files to C:\java\projects\BETS\exploded-archives\BETS.war\
            WEB-INF\classes
            
            ear:
                 [copy] Copying 11 files to C:\java\projects\BETS\exploded-archives\BETS.ear
            
                 [copy] Copying 2 files to C:\java\projects\BETS\exploded-archives\BETS.ear\
            lib
                 [copy] Copying 2 files to C:\java\projects\BETS\exploded-archives\BETS.ear\
            META-INF
            
            archive:
                  [jar] Building jar: C:\java\projects\BETS\dist\BETS.jar
                  [jar] Building jar: C:\java\projects\BETS\dist\BETS.war
                  [jar] Building jar: C:\java\projects\BETS\dist\BETS.ear
            
            datasource:
                 [copy] Copying 1 file to C:\java\jboss-eap-4.3\jboss-as\server\default\depl
            oy
            
            appconfig:
            
            deploy:
                 [copy] Copying 1 file to C:\java\jboss-eap-4.3\jboss-as\server\default\depl
            oy
                 [echo] is.nt = true
                 [echo] HTTP check for http://localhost:8080/BETS succeeded
                 [mail] Sending email: ant deploy target completed successfully for BETS
                 [mail] Sent email with 1 attachment
                 [echo] emailConfirmation target completed successfully
            
            BUILD SUCCESSFUL
            Total time: 40 seconds

            • 18. Re: configuring dev vs. prod modes for builds
              gonorrhea

              email body (using text/html mime type):



              Build Report for BETS
              
              Build complete based on checkout of this svn repos/tag: http://svn/repos/managed/_Sites/ORG/Applications/BETS/tags/0.5.0.0 
              
              Navigate to this URL to begin using the app: http://localhost:8080/BETS. Please view attached configuration file used during build/deploy process. Thanks for using build-gen.


              • 19. Re: configuring dev vs. prod modes for builds
                gonorrhea

                Jacob Orshalick wrote on Mar 27, 2009 22:12:


                If this is true, then why are my wildcard/tokenized values already replaced right after 'ant war' is run???

                If you are using 2.0.2, this was a bug in that version of seam-gen, see:  JBSEAM-3031

                You can apply the patch from JBSEAM-3157 to your gen'd project which will resolve the issue and allow you to use profile-specific components.properties configurations (e.g. dev, prod, and test).  This is covered in the seam-gen chapter of the book when we discuss profiles.

                Hope that helps.


                Well it may be this precisely causing that behavior in my build.xml war target:


                <copy todir="${war.dir}/WEB-INF">
                                        <fileset dir="${basedir}/resources/WEB-INF">
                                                <include name="*.*"/>
                                                <include name="classes/**/*.*"/>
                                                <exclude name="classes/**/*.class"/>
                                                  <exclude name="${basedir}/resources/WEB-INF/web.xml"/>
                                        </fileset>
                                         <!-- filter token replaces @debug@ and @jndiPattern@ in components.xml -->                     
                                        <filterset>                             
                                            <filter token="debug" value="${debug}" />
                                            <filter token="jndiPattern" value="${project.name}/#{ejbName}/local" />
                                        </filterset>
                                </copy>    



                I skimmed your article: http://solutionsfit.com/blog/2008/06/17/managing-environment-specific-configuration-with-seam/


                but my intention with build-gen is to make it so easy (an interview is about as easy as it can get!) so that anybody here on my team (we don't have a CM or build/release engr here) can handle the build/deploy if they know some basic params for build-gen.


                The easiest way to handle what you're doing in that article is to create a foo-config.properties file and have it sit in C:\java\jboss-eap-4.3\jboss-as\server\default\conf, for example.  Then read that key/value pair dynamically as required in the classes for your project.


                We have a util class that's part of our template code that is generated by our modded seam-gen:


                public class CoxProperties {
                     private static Properties ijwatProps = null;
                
                     public static Properties getPropertyObject(String configFileName) {
                          if (ijwatProps == null) {
                               ijwatProps = new Properties();
                               Enumeration<String> enumKeys;
                               ResourceBundle bundle = PropertyResourceBundle
                                         .getBundle(configFileName);
                               enumKeys = bundle.getKeys();
                               while (enumKeys.hasMoreElements()) {
                                    String key = (String) enumKeys.nextElement();
                                    ijwatProps.setProperty(key, (String) bundle.getString(key));
                               }
                          }
                
                          return ijwatProps;
                     }
                
                     public static Properties getPropertyObject() {
                          return getPropertyObject(CoxConstants.CONFIG_FILENAME);
                     }
                
                     public static String getProperty(String key) {
                          if (key == null)
                               return null;
                
                          return ijwatProps.getProperty(key);
                     }
                
                }



                The advantage of using this foo-config.properties file over components-dev.properties,
                components-test.properties, and components-prod.properties is that a CM or build engr can mod the foo-config.properties file (if required) in the server/xxx/conf directory and restart JBoss to pick up the changes.  Can't do that if the *.properties files are in the EAR/WAR (build is required).  Still I guess it's not a bad idea.  Better to minimize the total number of config files to keep it simpler.


                You Seam core devs need to think about the big picture when considering build/release process and what are the best practices when thinking about Seam apps, etc.  If somebody has a better idea or process for a small shop than my build-gen, holler!


                • 20. Re: configuring dev vs. prod modes for builds
                  erimag

                  Ron Ramirez wrote on Mar 27, 2009 23:26:


                  when I tried posting the entire ant target's script, it crashed this site (com.mysql.jdbc.MySqlDataTruncation: data too long for column 'DESCRIPTION_VALUE')



                  Hi Ron, I would be really interested in that ant script. Do you think you could post it on e.g. www.pastebin.com and post the link here, since you couldn't post it directly to the forum?


                  Thanks

                  • 21. Re: configuring dev vs. prod modes for builds
                    gonorrhea

                    Erik Magnusson wrote on Mar 30, 2009 10:49:



                    Ron Ramirez wrote on Mar 27, 2009 23:26:


                    when I tried posting the entire ant target's script, it crashed this site (com.mysql.jdbc.MySqlDataTruncation: data too long for column 'DESCRIPTION_VALUE')



                    Hi Ron, I would be really interested in that ant script. Do you think you could post it on e.g. www.pastebin.com and post the link here, since you couldn't post it directly to the forum?

                    Thanks


                    http://rabies.pastebin.com/f58b8e11c

                    • 22. Re: configuring dev vs. prod modes for builds
                      erimag

                      Excellent! Thank you!

                      1 2 Previous Next