Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-1972

karaf-maven-plugin should respect scope

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 3.0.0.RC1
    • None
    • karaf
    • None

    Description

      PROBLEM:

      currently, in project with dependencies such as these:

      		<dependency>
      			<groupId>org.osgi</groupId>
      			<artifactId>org.osgi.core</artifactId>
      			<scope>provided</scope>
      		</dependency>
      		<dependency>
      			<groupId>org.osgi</groupId>
      			<artifactId>org.osgi.compendium</artifactId>
      			<scope>provided</scope>
      		</dependency>
      
      

      karaf-maven-plugin with invocation like this:

      	<build>
      
      		<plugins>
      
      			<plugin>
      				<groupId>org.apache.karaf.tooling</groupId>
      				<artifactId>karaf-maven-plugin</artifactId>
      				<version>3.0.0-SNAPSHOT</version>
      				<executions>
      					<execution>
      						<id>generate-descriptor</id>
      						<phase>package</phase>
      						<goals>
      							<goal>features-generate-descriptor</goal>
      						</goals>
      						<configuration>
      							<installMode>auto</installMode>
      							<startLevel>90</startLevel>
      							<outputFile>./target/${project.artifactId}-${project.version}-features.xml</outputFile>
      						</configuration>
      					</execution>
      				</executions>
      			</plugin>
      
      		</plugins>
      
      	</build>
      
      

      will produce features.xml with entries:

              <bundle start-level="90">mvn:org.osgi/org.osgi.core/4.3.0</bundle>
              <bundle start-level="90">mvn:org.osgi/org.osgi.compendium/4.2.0</bundle>
      

      which is not as expected. scope==provided should not show up there.

      SOLUTION:

      instead, karaf-maven-plugin should respect scope;

      I suggest to add karaf-maven-plugin config parameters such as:

      <scopeInclude>
         <scope>compile</scope>
      </scopeInclude>
      

      or

      <scopeExclude>
         <scope>provided</scope>
         <scope>runtime</scope>
         <scope>test</scope>
      </scopeExclude>
      

      IMPACT:

      current plugin behavior forces to create a separate maven
      project to generate features.xml, since scope==provided
      is in fact excluded from transitive dependencies in that case.

      Attachments

        1. KARAF-1972.patch
          12 kB
          Christian Schneider
        2. 0001-Fixing-the-scope-handling.patch
          6 kB
          Robert Weiser

        Issue Links

          Activity

            People

              jbonofre Jean-Baptiste Onofré
              andrei.pozolotin Andrei Pozolotin
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: