You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2017/04/12 14:32:41 UTC

[jira] [Comment Edited] (SLING-3014) [build] Generate SCR descriptors using Maven

    [ https://issues.apache.org/jira/browse/SLING-3014?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15965936#comment-15965936 ] 

Konrad Windszus edited comment on SLING-3014 at 4/12/17 2:32 PM:
-----------------------------------------------------------------

With the PDE annotation builder the OSGI-INF folder is being placed in the root directory of the project. From there it is being picked up from the Eclipse Laucher as well. Unfortunately bnd-maven-plugin writes the OSGI-INF always to the folder given by configuration {{classesDir}} (https://github.com/bndtools/bnd/blob/master/maven/bnd-maven-plugin/src/main/java/aQute/bnd/maven/plugin/BndMavenPlugin.java#L270). Unfortunately {{classesDir}} is not only the used for expanding the JAR but also for generating the classpath for Bnd, therefore you cannot simply reconfigure that. Also the {{bnd-maven-plugin}} will only write those classes/resources which have not been existing in the target directory already (to distinguish between files being created by bnd and those which just have been wrapped in the JAR). But I found a simple workaround:

{code}
<plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-resources</id>
            <!-- make sure it runs after bnd-maven-plugin, i.e. after process-classes -->
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/OSGI-INF</outputDirectory>
              <resources>          
                <resource>
                  <directory>${project.build.outputDirectory}/OSGI-INF</directory>
                  <filtering>false</filtering>
                </resource>
              </resources>              
            </configuration>            
          </execution>
        </executions>
      </plugin>
{code}

That will copy the OSGI-INF to the root directory of the project from where it is being picked up by both PDE and Tycho. Of course the OSGI-INF needs to be listed in {{build.properties}} {{bin.includes}} as well.


was (Author: kwin):
With the PDE annotation builder the OSGI-INF folder is being placed in the root directory of the project. From there it is being picked up from the Eclipse Laucher as well. Unfortunately bnd-maven-plugin writes the OSGI-INF always to the folder given by configuration {{classesDir}} (https://github.com/bndtools/bnd/blob/master/maven/bnd-maven-plugin/src/main/java/aQute/bnd/maven/plugin/BndMavenPlugin.java#L270). Unfortunately {{classesDir}} is not only the used for expanding the JAR but also for generating the classpath for Bnd, therefore you cannot simply reconfigure that. I will try to come up with a PR for {{bnd-maven-plugin}} which allows to extract the JAR somewhere else.

> [build] Generate SCR descriptors using Maven
> --------------------------------------------
>
>                 Key: SLING-3014
>                 URL: https://issues.apache.org/jira/browse/SLING-3014
>             Project: Sling
>          Issue Type: Task
>          Components: IDE
>            Reporter: Robert Munteanu
>            Priority: Minor
>             Fix For: Sling Eclipse IDE 1.2.0
>
>         Attachments: SLING-3014-1.patch
>
>
> _Edit_: updated the issue title to reflect the fact that we're looking to use Maven, not a specific plug-in.
> Since we're starting to use SCR descriptors when building the Sling IDE tools it would be nice to generate them using the maven-scr-plugin. I have the build working in the CLI, but not yet in the IDE ( see http://dev.eclipse.org/mhonarc/lists/tycho-user/msg04764.html ). Once that is done I'll commit my changes to trunk.
> Note that plain Maven projects work just fine, this is about Tycho-driven builds.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)