[maven-repo-helper] 01/01: Parse and transform the module elements declared in profiles
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Jun 30 11:23:38 UTC 2014
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to branch master
in repository maven-repo-helper.
commit 4b49a7c2b664db0b723f69e18bae7e5c9e44c08a
Author: Emmanuel Bourg <ebourg at apache.org>
Date: Mon Jun 30 13:23:30 2014 +0200
Parse and transform the module elements declared in profiles
---
debian/changelog | 6 +
src/main/java/org/debian/maven/repo/POMReader.java | 3 +-
.../java/org/debian/maven/repo/POMTransformer.java | 4 +-
.../java/org/debian/maven/repo/POMReaderTest.java | 22 ++
.../org/debian/maven/repo/POMTransformerTest.java | 18 ++
src/test/resources/tika.pom | 231 +++++++++++++++++++++
6 files changed, 280 insertions(+), 4 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index a520653..ae17af0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+maven-repo-helper (1.8.8) unstable; urgency=medium
+
+ * Parse and transform the module elements declared in profiles
+
+ -- Emmanuel Bourg <ebourg at apache.org> Mon, 30 Jun 2014 12:20:52 +0200
+
maven-repo-helper (1.8.7) unstable; urgency=medium
* Fixed the parsing of the systemPath element (Closes: #740000)
diff --git a/src/main/java/org/debian/maven/repo/POMReader.java b/src/main/java/org/debian/maven/repo/POMReader.java
index 870f013..59a3092 100644
--- a/src/main/java/org/debian/maven/repo/POMReader.java
+++ b/src/main/java/org/debian/maven/repo/POMReader.java
@@ -124,8 +124,7 @@ public class POMReader {
} else if ("systemPath".equals(element)) {
currentDependency.setSystemPath(value);
}
- } else if (path.size() == 3 && "modules".equals(path.parent(1))) {
- // we're not interested in the modules section inside a profiles section
+ } else if ("modules".equals(path.parent(1)) && "module".equals(element)) {
modules.add(value);
} else if (path.size() == 3 && "parent".equals(path.parent(1))) {
if ("groupId".equals(element)) {
diff --git a/src/main/java/org/debian/maven/repo/POMTransformer.java b/src/main/java/org/debian/maven/repo/POMTransformer.java
index 192bd8c..64cd49d 100644
--- a/src/main/java/org/debian/maven/repo/POMTransformer.java
+++ b/src/main/java/org/debian/maven/repo/POMTransformer.java
@@ -341,12 +341,12 @@ public class POMTransformer extends POMReader {
continue;
}
}
- if (path.matches("/project/modules/module")) {
+ if (path.matches("/project/modules/module") || path.matches("/project/profiles/profile/modules/module")) {
String module = info.getModules().get(moduleDependencyIndex);
++moduleDependencyIndex;
if (!acceptModule(module, originalPom)) {
if (verbose) {
- System.out.println("Ignore module " + module + " in transformed POM");
+ System.out.println("Ignore module " + module + " in transformed POM");
}
inIgnoredElement++;
continue;
diff --git a/src/test/java/org/debian/maven/repo/POMReaderTest.java b/src/test/java/org/debian/maven/repo/POMReaderTest.java
index fd25324..aacd7e0 100644
--- a/src/test/java/org/debian/maven/repo/POMReaderTest.java
+++ b/src/test/java/org/debian/maven/repo/POMReaderTest.java
@@ -404,4 +404,26 @@ public class POMReaderTest {
assertFalse(path.matches("/c/d"));
assertFalse(path.matches("/d"));
}
+
+ /**
+ * Ensures all modules are properly parsed, including those defined in a profile.
+ */
+ @Test
+ public void testReadModules() throws Exception {
+ POMReader reader = new POMReader();
+ POMInfo info = reader.readPom(tmpDir.usePom("tika.pom"));
+
+ assertNotNull(info);
+ assertTrue("Module tika-parent not found", info.getModules().contains("tika-parent"));
+ assertTrue("Module tika-core not found", info.getModules().contains("tika-core"));
+ assertTrue("Module tika-parsers not found", info.getModules().contains("tika-parsers"));
+ assertTrue("Module tika-xmp not found", info.getModules().contains("tika-xmp"));
+ assertTrue("Module tika-serialization not found", info.getModules().contains("tika-serialization"));
+ assertTrue("Module tika-app not found", info.getModules().contains("tika-app"));
+ assertTrue("Module tika-bundle not found", info.getModules().contains("tika-bundle"));
+ assertTrue("Module tika-server not found", info.getModules().contains("tika-server"));
+ assertTrue("Module tika-translate not found", info.getModules().contains("tika-translate"));
+ assertTrue("Module tika-java7 not found", info.getModules().contains("tika-java7"));
+ assertEquals("Number of modules", 10, info.getModules().size());
+ }
}
diff --git a/src/test/java/org/debian/maven/repo/POMTransformerTest.java b/src/test/java/org/debian/maven/repo/POMTransformerTest.java
index 995105a..96b4d1f 100644
--- a/src/test/java/org/debian/maven/repo/POMTransformerTest.java
+++ b/src/test/java/org/debian/maven/repo/POMTransformerTest.java
@@ -22,6 +22,7 @@ import java.io.IOException;
import org.custommonkey.xmlunit.XMLUnit;
import org.debian.maven.TemporaryPomFolder;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -285,4 +286,21 @@ public class POMTransformerTest {
private void assertCleanedXMLEqual() throws SAXException, IOException {
assertXMLEqual(tmpDir.read(basename(tmpDir.pomInUse)+".transformed"), tmpDir.read(tmpDir.updatedPom()));
}
+
+ @Test
+ public void testTransformModules() throws Exception {
+ File pom = tmpDir.usePom("tika.pom");
+ instance.addIgnoreModule(pom, "tika-xmp");
+ instance.addIgnoreModule(pom, "tika-server");
+ instance.addIgnoreModule(pom, "tika-java7");
+ instance.getRulesFiles().addDefaultRules();
+ instance.transformPom(pom, tmpDir.updatedPom(), true, true, false, false, null, null);
+
+ POMReader reader = new POMReader();
+ POMInfo info = reader.readPom(tmpDir.read(tmpDir.updatedPom()));
+ Assert.assertFalse("Module tika-xmp hasn't been filtered", info.getModules().contains("tika-xmp"));
+ Assert.assertFalse("Module tika-server hasn't been filtered", info.getModules().contains("tika-server"));
+ Assert.assertFalse("Module tika-java7 hasn't been filtered", info.getModules().contains("tika-java7"));
+ assertEquals("Number of modules", 7, info.getModules().size());
+ }
}
diff --git a/src/test/resources/tika.pom b/src/test/resources/tika.pom
new file mode 100644
index 0000000..c156ccb
--- /dev/null
+++ b/src/test/resources/tika.pom
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.tika</groupId>
+ <artifactId>tika-parent</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <relativePath>tika-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tika</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tika</name>
+ <url>http://tika.apache.org</url>
+
+ <scm>
+ <connection>
+ scm:svn:http://svn.apache.org/repos/asf/tika/trunk
+ </connection>
+ <developerConnection>
+ scm:svn:https://svn.apache.org/repos/asf/tika/trunk
+ </developerConnection>
+ <url>http://svn.apache.org/viewvc/tika/trunk</url>
+ </scm>
+
+ <modules>
+ <module>tika-parent</module>
+ <module>tika-core</module>
+ <module>tika-parsers</module>
+ <module>tika-xmp</module>
+ <module>tika-serialization</module>
+ <module>tika-app</module>
+ <module>tika-bundle</module>
+ <module>tika-server</module>
+ <module>tika-translate</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip> <!-- No need to deploy the reactor -->
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <configuration>
+ <templateDirectory>src/site</templateDirectory>
+ <template>site.vm</template>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>.*/**</exclude>
+ <exclude>CHANGES.txt</exclude>
+ <exclude>tika-dotnet/AssemblyInfo.cs</exclude>
+ <exclude>tika-dotnet/Tika.csproj</exclude>
+ <exclude>tika-dotnet/Tika.sln</exclude>
+ <exclude>tika-dotnet/Tika.sln.cache</exclude>
+ <exclude>tika-dotnet/obj/**</exclude>
+ <exclude>tika-dotnet/target/**</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>apache-release</id>
+ <properties>
+ <username>${user.name}</username>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>src</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <descriptors>
+ <descriptor>assembly.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ <execution>
+ <id>source-release-assembly</id>
+ <configuration>
+ <skipAssembly>true</skipAssembly>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>deploy</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${basedir}/target/${project.version}" />
+ <copy todir="${basedir}/target/${project.version}" flatten="true">
+ <fileset dir="${basedir}">
+ <include name="CHANGES.txt" />
+ <include name="target/*-src.zip*" />
+ <include name="tika-app/target/*-${project.version}.jar*" />
+ </fileset>
+ </copy>
+ <checksum algorithm="MD5" fileext=".md5">
+ <fileset dir="${basedir}/target/${project.version}">
+ <include name="*.zip" />
+ <include name="*.?ar" />
+ </fileset>
+ </checksum>
+ <checksum algorithm="SHA1" fileext=".sha">
+ <fileset dir="${basedir}/target/${project.version}">
+ <include name="*.zip" />
+ <include name="*.?ar" />
+ </fileset>
+ </checksum>
+ <checksum file="${basedir}/target/${project.version}/tika-${project.version}-src.zip" algorithm="SHA1" property="checksum" />
+ <echo file="${basedir}/target/vote.txt">
+From: ${username}@apache.org
+To: dev at tika.apache.org
+Subject: [VOTE] Release Apache Tika ${project.version}
+
+A candidate for the Tika ${project.version} release is available at:
+
+ http://people.apache.org/~${username}/tika/${project.version}/
+
+The release candidate is a zip archive of the sources in:
+
+ http://svn.apache.org/repos/asf/tika/tags/${project.version}/
+
+The SHA1 checksum of the archive is ${checksum}.
+
+Please vote on releasing this package as Apache Tika ${project.version}.
+The vote is open for the next 72 hours and passes if a majority of at
+least three +1 Tika PMC votes are cast.
+
+ [ ] +1 Release this package as Apache Tika ${project.version}
+ [ ] -1 Do not release this package because...${line.separator}
+ </echo>
+ <echo />
+ <echo>
+The release candidate has been prepared in:
+
+ ${basedir}/target/${project.version}
+
+Please deploy it to people.apache.org like this:
+
+ scp -r ${basedir}/target/${project.version} people.apache.org:public_html/tika/
+
+A release vote template has been generated for you:
+
+ file://${basedir}/target/vote.txt
+ </echo>
+ <echo />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-nodeps</artifactId>
+ <version>1.8.1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>java7</id>
+ <activation>
+ <jdk>[1.7,]</jdk>
+ </activation>
+ <modules>
+ <module>tika-java7</module>
+ </modules>
+ </profile>
+ </profiles>
+
+ <description>The Apache Tika™ toolkit detects and extracts metadata and structured text content from various documents using existing parser libraries. </description>
+ <organization>
+ <name>The Apache Software Foundation</name>
+ <url>http://www.apache.org</url>
+ </organization>
+ <issueManagement>
+ <system>JIRA</system>
+ <url>https://issues.apache.org/jira/browse/TIKA</url>
+ </issueManagement>
+ <ciManagement>
+ <system>Jenkins</system>
+ <url>https://builds.apache.org/job/Tika-trunk/</url>
+ </ciManagement>
+</project>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven-repo-helper.git
More information about the pkg-java-commits
mailing list