Bug 787264

Summary: Plugin dependencies; commons-logging and cobertura have wrong scope
Product: [Other] RHQ Project Reporter: Elias Ross <genman>
Component: Build SystemAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED WORKSFORME QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 4.3CC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-03 16:41:47 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Elias Ross 2012-02-03 13:20:28 EST
I have a plugin with multiple dependencies.

I am using this to copy them to lib/

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                 <execution>
                    <phase>process-resources</phase>
                    <goals>
                       <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                       <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
                       <includeScope>runtime</includeScope>
                    </configuration>
                 </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

(BTW, this should probably be done for all plugins by default. It isn't really fun to have to include this for every plugin.)

Unfortunately RHQ pulls in cobertura and commons-logging.

I managed to fix cobertura issue:

diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index 389b69c..abc9d0c 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -87,6 +87,13 @@
          <groupId>net.sourceforge.cobertura</groupId>
          <artifactId>cobertura</artifactId>
          <version>${cobertura.version}</version>
+         <scope>test</scope> <!-- for testing only -->
+      </dependency>
+      <dependency>
+         <groupId>commons-logging</groupId>
+         <artifactId>commons-logging</artifactId>
+         <version>${commons-logging.version}</version>
+         <scope>provided</scope> <!-- by RHQ container -->
       </dependency>
    </dependencies>

but I can't seem to fix the logging dependency issue. The logging dependency should be 'provided' not 'compile'...
Comment 1 Mike Foley 2012-02-06 12:02:35 EST
per bz triage (asantos, ccrouch, mfoley. loleary)
Comment 2 Ian Springer 2012-06-06 10:48:22 EDT
I have not had any success using the copy-dependencies goal. It appears to be buggy and the way scopes are specified is very unintuitive.

I recommend using the copy-libs goal instead and explicitly specifying the jars you want to include, which is what we do in all the core plugins. For example, from the as7 plugin:

      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-libs</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.codehaus.jackson</groupId>
                  <artifactId>jackson-core-asl</artifactId>
                </artifactItem>

                <artifactItem>
                  <groupId>org.codehaus.jackson</groupId>
                  <artifactId>jackson-mapper-asl</artifactId>
                </artifactItem>

                <artifactItem>
                  <groupId>org.jboss.sasl</groupId>
                  <artifactId>jboss-sasl</artifactId>
                </artifactItem>
                
              </artifactItems>
              <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>



Defining an rhq-agent-plugin Maven packaging type that encapsulates things like copying runtime deps into the lib dir and validating the plugin descriptor is a good idea and something I have been wanting to do for a while. Can you create a separate BZ for that?
Comment 3 Elias Ross 2012-07-16 14:36:51 EDT
I created

Bug 840634 - Define an rhq-agent-plugin Maven packaging type

This bug may be marked as duplicate or closed.
Comment 4 Elias Ross 2014-06-03 16:41:47 EDT
I don't think this is an issue anymore.