This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include dependencies with Hadoop when publishing jar to maven
Summary: As external dependencies are added to Hadoop, we also have to add them to HBase, because the Hadoop .pom file we publish to the local Maven repository does not contain dependencies. Here I am trying to use the makepom target to auto-generate those dependencies from ivy. Also, I am setting Hadoop version to 0.20. I will double-check that this works correctly with build_all.sh in the warehouse branch. Test Plan: In Hadoop directory: ant clean copy-hdfs-jars-to-maven.sh In HBase directory: Build HBase In the warehouse branch checkout: ./build_all.sh --hadoop=true Reviewers: pritam, avf, weiyan, sdong, dms Reviewed By: pritam
- Loading branch information
mbautin
authored and
Alex Feinberg
committed
Aug 14, 2012
1 parent
8e53f44
commit eb7d5cd
Showing
3 changed files
with
97 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env python | ||
|
||
''' | ||
Reads the automatically generated Hadoop pom file, removes the "optional" | ||
flag from dependencies so that they could be included transitively into other | ||
projects such as HBase, and removes certain dependencies that are not required | ||
and could even break the code (e.g. an old version of xerces). Writes the | ||
modified project object model XML to standard output. | ||
''' | ||
|
||
import os | ||
import re | ||
import sys | ||
|
||
from xml.dom.minidom import parse | ||
|
||
NON_TRANSITIVE_DEPS = [ | ||
# Old version, breaks HBase | ||
'xerces', | ||
|
||
# Not used in production | ||
'checkstyle', | ||
'jdiff', | ||
|
||
# A release audit tool, probably not used in prod | ||
'rat-lib', | ||
] | ||
|
||
POM_FILE = 'build/ivy/maven/generated.pom' | ||
doc = parse(POM_FILE) | ||
deps = doc.getElementsByTagName('dependencies')[0] | ||
|
||
for dep in deps.getElementsByTagName('dependency'): | ||
for c in dep.childNodes: | ||
if (c.nodeName == 'artifactId' and | ||
c.firstChild and | ||
c.firstChild.nodeValue and | ||
c.firstChild.nodeValue.strip() in NON_TRANSITIVE_DEPS): | ||
deps.removeChild(dep) | ||
break | ||
|
||
for o in dep.getElementsByTagName('optional'): | ||
dep.removeChild(o) | ||
|
||
out_lines = doc.toprettyxml(indent=' ' * 2) | ||
lines = [] | ||
for l in out_lines.split('\n'): | ||
l = l.rstrip() | ||
if l: | ||
lines.append(l) | ||
output = '\n'.join(lines) | ||
|
||
# Make sure values stay on the same line: <element>value</element> | ||
output = re.sub( | ||
r'(<([a-zA-Z]+)>)' | ||
r'\s*([^<>]+?)\s*' | ||
r'(</\2>)', r'\1\3\4', output) | ||
|
||
print output | ||
|