aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKasun Gajasinghe <kasunbg@gmail.com>2011-08-06 17:09:52 +0000
committerKasun Gajasinghe <kasunbg@gmail.com>2011-08-06 17:09:52 +0000
commitad9748888b1dd286b6c805c6d4bce87760e9d2c9 (patch)
treeff1f5b03e8aa4d9f2d055f342f41654e47b60740
parentadded maven pom's <parent> tag rewriter. Three options to control it: --pgrou... (diff)
downloadjavatoolkit-ad9748888b1dd286b6c805c6d4bce87760e9d2c9.tar.gz
javatoolkit-ad9748888b1dd286b6c805c6d4bce87760e9d2c9.tar.bz2
javatoolkit-ad9748888b1dd286b6c805c6d4bce87760e9d2c9.zip
brought the parent element rewriting code to a separate function. Added another argument, --rewritesubmoduleppom, to control whether to rewrite_parent the submodules of the project or not.
svn path=/projects/javatoolkit/branches/kasun/; revision=8672
-rw-r--r--src/py/javatoolkit/maven/MavenPom.py12
-rwxr-xr-xsrc/py/maven-helper.py4
2 files changed, 12 insertions, 4 deletions
diff --git a/src/py/javatoolkit/maven/MavenPom.py b/src/py/javatoolkit/maven/MavenPom.py
index 9aa926c..7ccc341 100644
--- a/src/py/javatoolkit/maven/MavenPom.py
+++ b/src/py/javatoolkit/maven/MavenPom.py
@@ -105,9 +105,10 @@ class MavenPom:
return self.buffer.getvalue()
- def rewrite(self,xmldoc,**kwargs):
- #rewrite the <parent> with the values in self.cli_options.{p_parentgroup,p_parentartifact,p_parentversion}
- #This rewriting is optional. Packager may only rewrite version if he wishes.
+ def parent_rewrite(self,xmldoc,**kwargs):
+ #rewrite the <parent> element in the poms with the values in self.cli_options.{p_parentgroup,p_parentartifact,p_parentversion}
+ #This rewriting is optional. Packager may only rewrite version of the parent element as well if he wishes.
+ #This does not touch the parent pom.
parent_element = ( xmldoc.getElementsByTagName("parent") or [] )
if parent_element:
if self.cli_options.p_parentgroup:
@@ -128,6 +129,11 @@ class MavenPom:
# else:
# create parent element and map the parent to gentoo maven super pom. That contains all the plugin versions etc.
+ def rewrite(self,xmldoc,**kwargs):
+
+ if self.cli_options.p_rewrite_parent:
+ parent_rewrite(self.mydoc,**kwargs)
+
# desactivate all dependencies
dependencies_root = ( xmldoc.getElementsByTagName("dependencies") or [] )
for node in dependencies_root:
diff --git a/src/py/maven-helper.py b/src/py/maven-helper.py
index c0775a1..8abde58 100755
--- a/src/py/maven-helper.py
+++ b/src/py/maven-helper.py
@@ -36,7 +36,7 @@ if __name__ == '__main__':
usage += " %s [-a] [-v] [-g] [-d] [-f fic.xml]\n" % sys.argv[0]
usage += "Or:\n"
usage += " %s --rewrite [--classpath some.jar:class.jar:path.jar] [--source JVM_VER ] |--target JVM_VER]\n" % sys.argv[0]
- usage += " JVM_VER ::= 1.4 || 1.5 "
+ usage += " JVM_VER ::= 1.4 || 1.5 || 1.6"
usage += "\n"
usage += "If the -f parameter is not utilized, the script will read and\n"
usage += "write to stdin and stdout respectively. The use of quotes on\n"
@@ -104,6 +104,8 @@ if __name__ == '__main__':
make_option ("-r", "--rewrite", action="store_true", dest="p_rewrite", help="rewrite poms to use our classpath"),
make_option ("-p", "--ischild", action="store_true", dest="p_ischild", help="return true if this is a child pom"),
make_option ("-v", "--version" , action="store_true", dest="p_version", help="get artifact version."),
+
+ make_option ("-w", "--rewritesubmoduleppom" , action="store_true", dest="p_rewrite_parent", help="rewrite the <parent> element of poms of all sub-modules"),
make_option ("-x", "--pgroup" , action="append", dest="p_parentgroup", help="set <parent> groupId"),
make_option ("-y", "--partifact" , action="append", dest="p_parentartifact", help="set <parent> artifactId"),
make_option ("-z", "--pversion" , action="append", dest="p_parentversion", help="set <parent> version"),