Mojo not getting configuration from pom in integration-test phase
-----------------------------------------------------------------

         Key: MNG-1969
         URL: http://jira.codehaus.org/browse/MNG-1969
     Project: Maven 2
        Type: Bug

  Components: integration tests  
    Versions: 2.0.1    
 Environment: Windows
    Reporter: John Wells


I have a plugin that defines a new packaging type.  This is basically the same 
as the jar packaging type, except it does nothing in the test phase, has a 
special packaging phase (where some manifest entries are
added) and an integration-test phase that runs an integration test.

I am able to modify parameters in the "packaging" phase with no problem.
However, in the integration-test phase, for some reason, my parameters are not 
getting set from the pom.xml.  Here is the XML snippet from my
pom.xml:

      <plugin>
        <groupId>com.bea.core.maven2.plugins</groupId>
        <artifactId>maven-osgi-bundler-plugin</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>main</id>
            <phase>package</phase>
            <goals>
              <goal>osgi-bundle</goal>
            </goals>
            <configuration>
 
<bundleActivator>com.bea.jetty.JettyActivator</bundleActivator>
              <bundleName>Jetty HTTP</bundleName>
              <bundleDescription>OSGi HTTP service using 
Jetty</bundleDescription>
 
<bundleSymbolicName>com.bea.core.jetty</bundleSymbolicName>
              <importPackages>
                <importPackage>org.osgi.framework</importPackage>
                <importPackage>org.osgi.service.log</importPackage>
                <importPackage>com.bea.core.dioce</importPackage>
                <importPackage>com.bea.core.netio</importPackage>
                <importPackage>com.bea.core.wm</importPackage>
              </importPackages>
              <exportPackages>
                <exportPackage>javax.servlet;version=2.5</exportPackage>
 
<exportPackage>javax.servlet.http;version=2.5</exportPackage>
 
<exportPackage>org.osgi.service.http;version=1.2</exportPackage>
              </exportPackages>
              <bundleClasspaths>
                <bundleClasspath>.</bundleClasspath>
                <bundleClasspath>lib/http-service.jar</bundleClasspath>
                <bundleClasspath>lib/servlet.jar</bundleClasspath>
              </bundleClasspaths>
            </configuration>
          </execution>
          <execution>
            <id>test</id>
            <phase>package</phase>
            <goals>
              <goal>test-osgi-bundle</goal>
            </goals>
            <configuration>
 
<bundleActivator>com.bea.jetty.test.TestActivator</bundleActivator>
              <bundleName>Jetty HTTP Tests</bundleName>
              <bundleDescription>OSGi HTTP service using Jetty Testing 
Bundle</bundleDescription>
 
<bundleSymbolicName>com.bea.core.jetty.tests</bundleSymbolicName>
              <importPackages>
                <importPackage>org.osgi.framework</importPackage>
                <importPackage>javax.servlet</importPackage>
                <importPackage>javax.servlet.http</importPackage>
                <importPackage>org.osgi.service.http</importPackage>
              </importPackages>
            </configuration>
          </execution>
          <execution>
            <id>integration-test</id>
            <phase>integration-test</phase>
            <goals>
              <goal>run-osgi-test</goal>
            </goals>
            <configuration>
              <skip>true</skip>
            </configuration>
          </execution>
        </executions>
      </plugin>


With no problem at all the various variables I set in the "packaging"
phase are being set.  There are two mojo's there, with the goals osgi-bundle 
and test-osgi-bundle.  Both of those things seem to be getting their 
configuration parameters just fine from the pom.xml.

However, my run-osgi-test goal that happens from the integration-test phase is 
NOT getting the configuration parameter.

Here is the output from "mvn -X integration-test" (well, some of it)...

[DEBUG] Configuring mojo
'com.bea.core.maven2.plugins:maven-osgi-bundler-plugin:
1.0.0-SNAPSHOT:run-osgi-test' -->
[DEBUG]   (f) buildDirectory = C:\weblogic\dev\core\modules\jetty\target
[DEBUG]   (f) integrationDirectoryName = integration-test
[DEBUG]   (f) loadFileName = loader.xml
[DEBUG]   (f) project = [EMAIL PROTECTED]
[DEBUG]   (f) skip = false
[DEBUG]   (f) testTimeout = 300000


Etc.  At this point, shouldn't "skip" be "true" since I set it to "true"
in the pom.xml?

Here is the java:

/**
 * Should these tests be skipped?
 * @parameter expression="false"
 */
private boolean skip;

I have tried several things:

1) Making it a "String" rather than a Boolean
2) Moving it to the same package as the other mojo's that *are* getting their 
variables configured properly
3) Having multiple "plugin" definitions in the pom file

Here is something else I just found out:

If instead I change the last "execution" for the plugin to be for phase 
"package", then my variables get set properly.  So, if my pom.xml instead has 
this:

<execution>
  <id>integration-test</id>
  <phase>package</phase>
  <goals>
    <goal>run-osgi-test</goal>
  </goals>
  <configuration>
    <skip>true</skip>
  </configuration>
</execution>

The problem with this is that my run-osgi-test then properly picks up the 
variables in the "packaging" phase but then goes ahead and runs with the 
variables not set in the "integration-test" phase.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to