Skip to content

Latest commit

 

History

History
119 lines (105 loc) · 4.49 KB

guide_java.md

File metadata and controls

119 lines (105 loc) · 4.49 KB

Java Contribution Guide

Contributors who would like host their java libraries in opentracing-contrib organization should abide following rules:

Choosing artifactId and groupId

   <dependency>
       <groupId>io.opentracing.contrib</groupId>
       <artifactId>opentracing-XXX</artifactId>
   </dependency>
  • XXX - stands for a repository name without java prefix

Release configuration

We encourage you to use the same release process as for opentracing-api artifact. General release process is described in opentracing-java/RELEASE.md. Release is done by travis when pushing an appropriate tag to the upstream repository (release-0.0.1).

Configuration is done in opentracing-java/pom.xml. It depends on on .settings.xml, .travis.yml and travis/publish.sh. Note that scripts are using maven wrapper ./mvnw to pin a consistent version. Wrapper can be generated by mvn -N io.takari:maven:wrapper -Dmaven=3.3.9. This adds a jar file to the repository. Make sure it is not ignored by .gitignore.

pom.xml has to align with Sonatype requirements and use following configuration:

  <distributionManagement>
    <repository>
      <id>bintray</id>
      <url>https://api.bintray.com/maven/opentracing/maven/XXX/;publish=1</url> <!-- XXX - maven package name in Bintray -->
    </repository>
    <snapshotRepository>
      <id>jfrog-snapshots</id>
      <url>http://oss.jfrog.org/artifactory/oss-snapshot-local</url>
    </snapshotRepository>
  </distributionManagement>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>release</releaseProfiles> <!-- attaches javadocs and sources -->
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <tagNameFormat>@{project.version}</tagNameFormat>
        </configuration>
      </plugin>
      <plugin>
        <groupId>io.zipkin.centralsync-maven-plugin</groupId>
        <artifactId>centralsync-maven-plugin</artifactId>
        <configuration>
          <subject>opentracing</subject>
          <repo>maven</repo>
          <packageName>XXX</packageName> <!-- XXX - maven package name in Bintray -->
        </configuration>
      </plugin>
    </plugins>
  </build>
  
  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <!-- Creates source jar -->
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- Creates javadoc jar -->
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <failOnError>false</failOnError>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  • XXX - stands for maven package name in Bintray. It can be equal to the repository name or artifactId. We encourage you to create it in Bintray UI before the first release.

Please submit this configuration in an individual pull request, to see that everything is properly configured.

Release rights

For a successful release several access rights are needed:

  1. Bintray - register and request access directly in the organization; ping @bhs on our gitter channel to speed up the process
  2. Sonatype - request access directly in the issue

These need to be re-encrypted and added to .travis.yml.

Sync to JCenter (maven central)

By default package is not published to maven central. To be synced it needs to be included in JCenter repository. This has to be done manually in Bintray UI after the first release. On following releases this is done automatically by the centralsync-maven-plugin.