DRILL-6280: Cleanup execution of BuildTimeScan during maven build closes #1177
Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/a8c46445 Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/a8c46445 Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/a8c46445 Branch: refs/heads/master Commit: a8c46445a6febd21d19ca1338003d65df072dc18 Parents: 051a96d Author: Vlad Rozov <[email protected]> Authored: Tue Mar 20 19:24:11 2018 -0700 Committer: Vitalii Diravka <[email protected]> Committed: Mon Mar 26 13:02:57 2018 +0300 ---------------------------------------------------------------------- common/pom.xml | 16 +++---------- .../drill/common/scanner/BuildTimeScan.java | 8 +++---- exec/java-exec/pom.xml | 24 +------------------- logical/pom.xml | 24 +------------------- pom.xml | 20 ++++++++++++++++ 5 files changed, 29 insertions(+), 63 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/a8c46445/common/pom.xml ---------------------------------------------------------------------- diff --git a/common/pom.xml b/common/pom.xml index 31cce21..bf32e26 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -113,20 +113,10 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> - <version>1.2.1</version> - <executions> - <execution> - <phase>process-classes</phase> - <goals> - <goal>java</goal> - </goals> - </execution> - </executions> <configuration> - <mainClass>org.apache.drill.common.scanner.BuildTimeScan</mainClass> - <arguments> - <argument>${project.build.outputDirectory}</argument> - </arguments> + <additionalClasspathElements> + <additionalClasspathElement>${project.basedir}/src/test/resources/</additionalClasspathElement> + </additionalClasspathElements> </configuration> </plugin> </plugins> http://git-wip-us.apache.org/repos/asf/drill/blob/a8c46445/common/src/main/java/org/apache/drill/common/scanner/BuildTimeScan.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/drill/common/scanner/BuildTimeScan.java b/common/src/main/java/org/apache/drill/common/scanner/BuildTimeScan.java index 28f3704..7f2aaa0 100644 --- a/common/src/main/java/org/apache/drill/common/scanner/BuildTimeScan.java +++ b/common/src/main/java/org/apache/drill/common/scanner/BuildTimeScan.java @@ -45,8 +45,8 @@ public class BuildTimeScan { private static final String REGISTRY_FILE = "META-INF/drill-module-scan/registry.json"; private static final ObjectMapper mapper = new ObjectMapper().enable(INDENT_OUTPUT); - private static final ObjectReader reader = mapper.reader(ScanResult.class); - private static final ObjectWriter writer = mapper.writerWithType(ScanResult.class); + private static final ObjectReader reader = mapper.readerFor(ScanResult.class); + private static final ObjectWriter writer = mapper.writerFor(ScanResult.class); /** * @return paths that have the prescanned registry file in them @@ -118,10 +118,10 @@ public class BuildTimeScan { */ public static void main(String[] args) throws Exception { if (args.length != 1) { - throw new IllegalArgumentException("Usage: java {cp} " + ClassPathScanner.class.getName() + " path/to/scan"); + throw new IllegalArgumentException("Usage: java {cp} " + BuildTimeScan.class.getName() + " path/to/scan"); } String basePath = args[0]; - System.out.println("Scanning: " + basePath); + logger.info("Scanning: {}", basePath); File registryFile = new File(basePath, REGISTRY_FILE); File dir = registryFile.getParentFile(); if ((!dir.exists() && !dir.mkdirs()) || !dir.isDirectory()) { http://git-wip-us.apache.org/repos/asf/drill/blob/a8c46445/exec/java-exec/pom.xml ---------------------------------------------------------------------- diff --git a/exec/java-exec/pom.xml b/exec/java-exec/pom.xml index 205f3ed..f2d2ebd 100644 --- a/exec/java-exec/pom.xml +++ b/exec/java-exec/pom.xml @@ -828,31 +828,9 @@ </execution> </executions> </plugin> - <plugin> <!-- classpath scanning --> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> - <version>1.2.1</version> - <dependencies> - <dependency> - <groupId>org.apache.drill</groupId> - <artifactId>drill-common</artifactId> - <version>${project.version}</version> - <classifier>tests</classifier> - </dependency> - </dependencies> - <executions> - <execution> - <phase>process-classes</phase> - <goals><goal>java</goal></goals> - </execution> - </executions> - <configuration> - <mainClass>org.apache.drill.common.scanner.BuildTimeScan</mainClass> - <includePluginDependencies>true</includePluginDependencies> - <arguments> - <argument>${project.build.outputDirectory}</argument> - </arguments> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> http://git-wip-us.apache.org/repos/asf/drill/blob/a8c46445/logical/pom.xml ---------------------------------------------------------------------- diff --git a/logical/pom.xml b/logical/pom.xml index 1cd9f02..429baad 100644 --- a/logical/pom.xml +++ b/logical/pom.xml @@ -109,31 +109,9 @@ <build> <plugins> - <plugin> <!-- classpath scanning --> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> - <version>1.2.1</version> - <dependencies> - <dependency> - <groupId>org.apache.drill</groupId> - <artifactId>drill-common</artifactId> - <version>${project.version}</version> - <classifier>tests</classifier> - </dependency> - </dependencies> - <executions> - <execution> - <phase>process-classes</phase> - <goals><goal>java</goal></goals> - </execution> - </executions> - <configuration> - <mainClass>org.apache.drill.common.scanner.BuildTimeScan</mainClass> - <includePluginDependencies>true</includePluginDependencies> - <arguments> - <argument>${project.build.outputDirectory}</argument> - </arguments> - </configuration> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> http://git-wip-us.apache.org/repos/asf/drill/blob/a8c46445/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index b46bc6f..8c1c682 100644 --- a/pom.xml +++ b/pom.xml @@ -451,6 +451,26 @@ <artifactId>maven-enforcer-plugin</artifactId> <version>1.3.1</version> </plugin> + <plugin> <!-- classpath scanning --> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.6.0</version> + <executions> + <execution> + <phase>process-classes</phase> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>org.apache.drill.common.scanner.BuildTimeScan</mainClass> + <classpathScope>test</classpathScope> + <arguments> + <argument>${project.build.outputDirectory}</argument> + </arguments> + </configuration> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId>
