Github user neykov commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/120#issuecomment-52759505
  
    Would be great if it packages the projects as OSGi bundles out of the box. 
The following should be sufficient to do it:
    
    ```xml
            <profile>
                <id>Bundle</id>
                <activation>
                    <file>
                        <!-- NB - this is all the leaf projects, including 
logback-* (with no src);
                             the archetype project neatly ignores this however 
-->
                        <exists>${basedir}/src</exists>
                    </file>
                </activation>
                <build>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.felix</groupId>
                            <artifactId>maven-bundle-plugin</artifactId>
                            <extensions>true</extensions>
                            <!-- configure plugin to generate MANIFEST.MF
                                 adapted from 
http://blog.knowhowlab.org/2010/06/osgi-tutorial-from-project-structure-to.html 
-->
                            <executions>
                                <execution>
                                    <id>bundle-manifest</id>
                                    <phase>process-classes</phase>
                                    <goals>
                                        <goal>manifest</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <supportedProjectTypes>
                                    
<supportedProjectType>jar</supportedProjectType>
                                </supportedProjectTypes>
                                <instructions>
                                    <!-- OSGi specific instruction -->
                                    <!--
                                        By default packages containing impl and 
internal
                                        are not included in the export list. 
Setting an
                                        explicit wildcard will include all 
packages
                                        regardless of name.
                                        In time we should minimize our export 
lists to
                                        what is really needed.
                                    -->
                                    <Export-Package>brooklyn.*</Export-Package>
                                </instructions>
                            </configuration>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-jar-plugin</artifactId>
                            <configuration>
                                <archive>
                                    <manifestFile> 
${project.build.outputDirectory}/META-INF/MANIFEST.MF </manifestFile>
                                </archive>
                            </configuration>
                        </plugin>
                    </plugins>
                </build>
            </profile>
    ```
    
    Also the brooklyn's parent POM adds an exclusion specifically for m2e, 
though I don't get errors even if it is not present:
    
    ```xml
        <build>
            <pluginManagement>
                <plugins>
                    <plugin>
                        <!-- This configuration is used for Eclipse settings 
only. -->
                        <groupId>org.eclipse.m2e</groupId>
                        <artifactId>lifecycle-mapping</artifactId>
                        <version>1.0.0</version>
                        <configuration>
                            <lifecycleMappingMetadata>
                                <pluginExecutions>
                                    <pluginExecution>
                                            <groupId>org.apache.felix</groupId>
                                            
<artifactId>maven-bundle-plugin</artifactId>
                                            
<versionRange>[2.3.4,)</versionRange>
                                            <goals>
                                                <goal>manifest</goal>
                                            </goals>
                                        </pluginExecutionFilter>
                                        <action>
                                            <ignore />
                                        </action>
                                    </pluginExecution>
    ...
    
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to