Looks like the bits to configure surefire are fine, except you'd want to change the value of "somedir".

I recommend that you use the dependency plugin in your module's pom to download and install the needed jars to be placed into the "endorsed" dir (which will end up in the modules target/endorsed or something similar). Then configure the java.endorsed.dirs to point at that directory.

Here is an example... not the right dependencies but I think it will give you the idea:

{code:xml}
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>dependency-maven-plugin</artifactId>
        <executions>
            <execution>
                <id>unpack-endorsed</id>
                <phase>generate-test-resources</phase>
                <goals>
                    <goal>unpack</goal>
                </goals>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>org.apache.yoko</groupId>
                            <artifactId>yoko</artifactId>
                            <version>1.0</version>
                            <type>jar</type>
                        </artifactItem>
                    </artifactItems>
<outputDirectory>${project.build.directory}/ endorsed</outputDirectory>
                </configuration>
            </execution>
        </executions>
    </plugin>

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
            <forkMode>once</forkMode>
<workingDirectory>${project.build.directory}</ workingDirectory> <argLine>-Djava.endorsed.dirs=${project.build.directory}/ endorsed</argLine>
        </configuration>
    </plugin>
{code}

Lemme know if you need anything else.

--jason


On Aug 23, 2006, at 10:13 AM, Dain Sundstrom wrote:

You will need to configure the surefire (testing) plugin to fork your tests into a new vm and set the endorsed dir for that new vm. The first is easy but the second will be difficult. First off the docs for the sure fire plugin can be found here

http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html

Here is an example setting
<project>
  ...
  <build>
    ...
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <configuration>
        <forkMode>once</forkMode >
        <argLine>-Djava.endorsed.dirs=somedir</argLine>
      </configuration>
    </plugin>
    ...
  </build>
  ...
</project>

The problem will be selecting a dir on the filesystem that will include the endorsed API. BTW you could also set the boot class path in the argLine above, but testing endorsed dir will be more representative of the runtime environment.

Jason, you have any ideas on how to configure this?

-dain

On Aug 23, 2006, at 3:10 AM, Rick McGuire wrote:

Dain Sundstrom wrote:
On Aug 11, 2006, at 12:40 PM, Dain Sundstrom wrote:

Rick,

I believe what you really want to do is to use the endorsed directory. This allows you to override the vm implementation of endorsed specification such as corba (https://java.sun.com/j2se/ 1.5.0/docs/guide/standards/index.html). In general, you should try to keep the stuff in the endorsed jar to a minimum as not to pollute the class path. In geronimo, to add something to the endorsed dir, you need to add it to our endorsed manifest entry "Endorsed-Dirs" (I have no idea where this is set in the build) and you need to modify the build to put the jar into lib/ endorsed by modifying the bin.xml.

I'm dumb. You simply need to add the jar to lib/endorsed jar in the boilerplate config (thanks Jason), and add it to the manifest class path of the j2ee-system configuration (see the pom file in that dir). It will be added to the system class path and marked as endorsed so it can override the corba specs just like we override the xml specs using xerces.
Ok, this looks pretty simple, but, unfortunately, it only addresses the issues when running/building Geronimo. I'm running into a problem trying to get the unit tests to run while building openejb2. I've been trying to find the equivalent touch points in the openejb2 build, and have not had much success. I'm definitely skating on thin ice (not good for a person of my size :-) ) when it comes to the m2 stuff, so I'd appreciate any help/pointers I can get on this.
Rick



-dain



Reply via email to