[weld-dev] WELD-273 Add GlassFish targets to example POMs

Karel Piwko kpiwko at redhat.com
Fri Nov 5 10:52:30 EDT 2010


Hi Marcin,

I went through your code, see inline comments.

Could you please create a fork of my Weld/core repository 
at https://github.com/kpiwko/core so you can simply send me an pull
request after each change and I'll comment inline?

Feel free to ask me any question, I'll be definitely more responsive
since now :).

Karel


On Tue, 2010-10-26 at 02:19 +0200, Marcin Mieszek wrote:
> Hi,
> 
> I have made some progress with issue WELD-273. Please find diff file
> attached for the first example (weld-jsf-login) and let me know if the
> apporach is correct.

> Originally I planned to use glassfish-embedded server, but maven
> plugin does not have the option to run the server in another process
> so that integration tests are not blocked by the server processing its
> requests (similar thing is done with jetty and daemon parameter). I
> also did not have success with cargo plugin so I switched to
> glassfish-maven-plugin.
> 
> Changes description:
> 
> Defining ftest-glassfish profile:
> #       modified:   examples/jsf/login/pom.xml
> #       modified:   examples/pom.xml
This is right, however I would like rather to see split profiles for
container deployement and ftest I was talking about the last time.

> 
> Copy of test suite definition from jboss6x.xml. Do we really need
> seperate one for each appserver?
> #       new file:   examples/jsf/login/src/ftest/resources/glassfish3x.xml
> 
We'll stuck for one file per app server at the moment for customization
reasons. If you want to use the same file, you can override
ftest.suite.xml property in profiles to link to the one file for the all
containers, but I'd rather discourage this.

> Making the class implement Serializable interface to avoid Glassfish
> deployments errors:
> #       modified:
> examples/jsf/login/src/main/java/org/jboss/weld/examples/login/Credentials.java
> 
> Setting table name to USER_TABLE as USER is reserved word:
> #       modified:
> examples/jsf/login/src/main/java/org/jboss/weld/examples/login/User.java
> #       modified:   examples/jsf/login/src/main/resources/import.sql
> 
This is perfectly ok.

> Setting to <jta-data-source>jdbc/LoginDS</jta-data-source> so that
> this is accepted by Glassfish:
> #       modified:
> examples/jsf/login/src/main/resources/META-INF/persistence.xml

This won't work. It is not a good idea to change persistence.xml because
Glassfish requires so even for JBoss AS.

You'll have to split according to the profiles here as well.

It's relatively easy:

1/ You'll create directories like src/main/webapp-jbossas,
src/main/webapp-glassfish

2/ You'll let the common configuration in src/main/webapp

3/ You'll configure war plugin in each profile to include appropriate
directory, this will merge the content of src/main/webapp and
src/main/webapp-${container} such as


         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-war-plugin</artifactId>
                  <configuration>
                     <webResources>
                        <resource>
<directory>src/main/webapp-jboss</directory>
                           <filtering>true</filtering>
                        </resource>
                     </webResources>
                  </configuration>
               </plugin>
            </plugins>
         </build>
 

You can see that in weld-numberguess example.

Another thing there, I'm curious, why did you add DerbyDialect? It
wasn't working with defaults?

> 
> One final question:
> 
> Currently there are several apporaches toward ftest. Tomcat and JBoss
> use cargo plugin while Jetty uses maven-jetty-plugin. Moreover each
> profile contains the same copy of failsafe plugin configuration. Can I
> simplify it somehow? How about using unified apporach to deployments?
> 
> Looking forward to feedback from you,
> 
> Marcin
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev




More information about the weld-dev mailing list