Hi Bill,

On 21/03/17 16:01, Bill Mair wrote:
Hi,

I'm attempting to switch to maven to create my packages but I have hit a
snag that I can't find a solution for.

Up until now, I have been controlling the dependencies of my ant build
process with the contents of "META-INF/MANIFEST.MF". Maven works the
other way around and generates that based on what I have actually used,
which I think is fantastic.

You can use Maven Tycho which gives you back the switch of requirement. In Tycho you can either work MANIFEST first or POM first setup...

https://eclipse.org/tycho/


And of course if your working on OSGi it makes sense to control the dependencies via MANIFEST via Eclipse which can handle that very good (dependencies, tree etc., target platforms etc.).




I already have the git hash being included by buildnumber-maven-plugin
(which required the additional pluginManagement section to work
correctly in eclipse).

Than you are using an old version cause 3.0.0 already includes this mapping for m2e...



My problem is that this is only generated when I build the bundle and
not during incremental saves.

The reason is simply cause you changed the side which means pom first..which I would say is not a good idea in OSGi and Eclipse...


Kind regards
Karl Heinz Marbaise


What do I have to change in this pom.xml to make eclipse, m2e, maven and
the maven-bundle-plugin play nicely together?

--
Bill Mair

pom.xml
------------
<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";>

    <properties>
        <bundle.symbolicName>test.iface</bundle.symbolicName>
        <bundle.namespace>test.iface</bundle.namespace>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.build.timestamp.format>yyyy/MM/dd HH:mm:ss
z</maven.build.timestamp.format>
    </properties>

    <modelVersion>4.0.0</modelVersion>
    <groupId>test</groupId>
    <artifactId>test.iface</artifactId>
    <version>1.0.1</version>

    <scm>
        <connection>scm:git:file://.</connection>
        <developerConnection>scm:git:file://.</developerConnection>
        <url>scm:git:file://.</url>
        <tag>HEAD</tag>
    </scm>

    <dependencies>
        <!-- eclipse virgo - equinox OSGi version -->
         <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>5.0.0</version>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <version>4.3.0</version>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>javax.jws</groupId>
            <artifactId>jsr181-api</artifactId>
            <version>1.0-MR1</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>compile</scope>
            <optional>true</optional>
        </dependency>
    </dependencies>

    <packaging>bundle</packaging>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.0.1</version>
                <extensions>true</extensions>
                <configuration>
                    <manifestLocation>META-INF</manifestLocation>
                    <instructions>

<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
                        <Bundle-Version>${project.version}</Bundle-Version>

<Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
                        <Bundle-Copyright>Copyright (C)
${project.organization.name}</Bundle-Copyright>


<Implementation-Build-Time>${maven.build.timestamp}</Implementation-Build-Time>

<Implementation-Build>${buildNumber}</Implementation-Build>

                        <!-- assume public classes are in the top
package, and private classes are under ".internal" -->


<Export-Package>!${bundle.namespace}.internal.*,${bundle.namespace}.*;version="${project.version}"</Export-Package>

                        <!--

<Private-Package>${bundle.namespace}.*</Private-Package>

<Bundle-Activator>${bundle.namespace}.Activator</Bundle-Activator>

<Private-Package>${bundle.namespace}.internal.*</Private-Package>

<Bundle-Activator>${bundle.namespace}.internal.ExampleActivator</Bundle-Activator>

<Fragment-Host>org.fragment.host;bundle-version="1.0.0"</Fragment-Host>

<Service-Component>OSGI-INF/configuration.xml</Service-Component>

<Service-Component>OSGI-INF/*.xml</Service-Component>
                        -->
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <doCheck>false</doCheck>
                    <doUpdate>false</doUpdate>
                </configuration>
            </plugin>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.4</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>

<artifactId>buildnumber-maven-plugin</artifactId>
                                        <versionRange>[1.0,)</versionRange>
                                        <goals>
                                            <goal>create</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute>

<runOnIncremental>true</runOnIncremental>
                                        </execute>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to