Mitigate unpublished dependencies when using Cassandra with Maven
-----------------------------------------------------------------

                 Key: CASSANDRA-697
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-697
             Project: Cassandra
          Issue Type: Improvement
          Components: Core, Tools
    Affects Versions: 0.5
            Reporter: Stephen Gargan
            Priority: Minor
             Fix For: 0.5
         Attachments: dependency-patch.txt

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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to