Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] Working with 3rd party dependencies

Hi,

I'm wondering what is the proper way to work with 3rd party dependencies. I know there has been already quite a bit of a discussion, but I still have not found any easy to use solution.

My requirements are:

1. easy for a developer to add a new dependency (should be comparable with the effort one has to do when adding a regular dependency in maven)
2. support source features
3. be usable both in tycho build and in eclipse (without M2E)

I started with [1] and here is my current workflow using tycho only:

1. get the library using maven dependency plugin
2. in eclipse create a new plugin project using existing JAR
3. update MANIFEST.MF, build.properties and pom.xml so it corresponds well to the artifact (example is below)
  - tweak transitive dependencies
  - tweak the MANIFEST in cases the artifact is not a proper OSGi bundle
  - sync names and versions
4. update parent project's pom.xml (example is below)
5. update feature.xml
6. build

I ended up using twice the maven dependency plugin to unpack both the artifact's classes and sources.

While it works it seems to be overly complicated for something which could be very easy. Of cause it can be scripted, but I guess there is an easier way to do this?

I found the p2-maven-plugin, but that one does not support source bundles neither it can manipulate MANIFEST.MF in cases an artifact is not a proper OSGi bundle.

Thanks a lot for any suggestions!
Filip

--

[1] http://software.2206966.n2.nabble.com/How-to-manage-dependencies-in-a-manifest-first-build-td5355462.html


org.apache.commons.lang3/pom.xml:
--
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"; xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>repo</groupId>
		<artifactId>parent</artifactId>
		<version>1.0.0-SNAPSHOT</version>
		<relativePath>../parent</relativePath>
	</parent>

	<artifactId>org.apache.commons.lang3</artifactId>
	<version>3.1.0</version>
	<packaging>eclipse-plugin</packaging>

	<dependencies>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>3.1</version>
		</dependency>
	</dependencies>

</project>

parent/pom.xml
--
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"; xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <modelVersion>4.0.0</modelVersion>

  <groupId>repo</groupId>
  <artifactId>parent</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <properties>
    <tycho.version>0.15.0</tycho.version>
  </properties>

  <modules>
    <module>feature</module>
    <module>site</module>

    <!-- 3rd party modules -->
    <module>../org.apache.commons.lang3</module>
  </modules>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.5</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.5</version>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>initialize</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
<outputDirectory>${project.build.outputDirectory} </outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>copy-dependencie-sources</id>
            <phase>initialize</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>

<outputDirectory>${project.build.directory}/src</outputDirectory>
              <classifier>sources</classifier>

<failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-p2-repository-plugin</artifactId>
        <version>${tycho.version}</version>
      </plugin>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-maven-plugin</artifactId>
        <version>${tycho.version}</version>
        <extensions>true</extensions>
      </plugin>
      <plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-compiler-plugin</artifactId>
				<version>${tycho.version}</version>
				<configuration>
					<excludes>
						<exclude>**/*.*</exclude>
					</excludes>
				</configuration>
			</plugin>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-source-plugin</artifactId>
        <version>${tycho.version}</version>
        <executions>
          <execution>
            <id>plugin-source</id>
            <goals>
              <goal>plugin-source</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>



Back to the top