Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-697

Mitigate unpublished dependencies when using Cassandra with Maven

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Won't Fix
    • 0.5
    • Legacy/Tools
    • None

    Description

      So I have a suggestion to improve the maven build and help mitigate the fact that cassandra relies on unpublished dependencies. While the system dependency approach works fine for building cassandra alone, it breaks down somewhat if you include cassandra as a dependency in another project. The problem stems from the fac that system dependency paths must be absolute, but in the cassandra pom they are relative to the project root. When cassandra is then used as a dependency elsewhere, all the dependencies from the cassandra pom are ignored

      [WARNING] POM for 'org.apache.cassandra:cassandra:pom:0.5:compile' is invalid. It will be ignored for artifact resolution. Reason: Failed to validate POM for project org.apache.cassandra:c
      [DEBUG] Reason: Failed to validate POM for project org.apache.cassandra:cassandra at Artifact [org.apache.cassandra:cassandra:pom:0.5:compile]
      [DEBUG]
      Validation Errors:
      [DEBUG] For dependency Dependency

      {groupId=high-scale-lib, artifactId=high-scale-lib, version=UNKNOWN, type=jar}

      : system-scoped dependency must specify an absolute path systemPath.
      [DEBUG] For dependency Dependency

      {groupId=libthrift, artifactId=libthrift, version=UNKNOWN, type=jar}

      : system-scoped dependency must specify an absolute path systemPath.
      [DEBUG] For dependency Dependency

      {groupId=reardencommerce, artifactId=reardencommerce, version=UNKNOWN, type=jar}

      : system-scoped dependency must specify an absolute path systemPath.
      [DEBUG] For dependency Dependency

      {groupId=jsonsimple, artifactId=jsonsimple, version=UNKNOWN, type=jar}

      : system-scoped dependency must specify an absolute path systemPath.
      [DEBUG] For dependency Dependency

      {groupId=com.reardencommerce, artifactId=clhm, version=UNKNOWN, type=jar}

      : system-scoped dependency must specify an absolute path systemPath.

      There are a couple of ways to fix this. Ideally if the failing deps could get published to a public repo the problem goes away. As a stopgap (for this less than perfect world) it would nice if it were easy to install the respective jars from the ant build to a local or network maven repo, so I've created a pom to do this.

      The pom, in the lib dir, specifies two profiles install and deploy; The 'install' profile is run via

      mvn validate -Pinstall

      and will install them in the local repo on your machine.

      Just having install is a pain where you have more than one developer as it will require each to get the source and execute the profile, so to make them available for a whole team the 'deploy' profile can be used to deploy them to an enterprise repository such as nexus. This is done via

      mvn -Pdeploy validate -DrepositoryId=thirdparty -DrepositoryUrl=http://mfdevrepo:8081/nexus/content/repositories/thirdparty

      The pom now references the dependencies as normal from the local repo. The version was specified where it was obvious and where not 'cassandra-version' was used to avoid collisions and hint at the origin.

      <dependency>
      <groupId>high-scale-lib</groupId>
      <artifactId>high-scale-lib</artifactId>
      <version>cassandra-${version}</version>
      </dependency>
      <dependency>
      <groupId>libthrift</groupId>
      <artifactId>libthrift</artifactId>
      <version>r894924</version>
      </dependency>
      <dependency>
      <groupId>json-simple</groupId>
      <artifactId>json-simple</artifactId>
      <version>1.1</version>
      </dependency>
      <dependency>
      <groupId>com.reardencommerce</groupId>
      <artifactId>clhm</artifactId>
      <version>cassandra-${version}</version>
      </dependency>

      I took the liberty of adding SNAPSHOT to the pom version too as having a non SNAPSHOT version will cause maven to think the pom is released and cast in stone and subsequent updates will not be retrieved and problems related to this can be hard to track down.

      I hope you can get some use from this. Thanks for the great project!

      rgds,

      ste

      Attachments

        1. dependency-patch.txt
          10 kB
          Stephen Gargan

        Activity

          People

            Unassigned Unassigned
            sgargan Stephen Gargan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: