From 3106989d98d9dcc5578955ed1395e29dea5a217f Mon Sep 17 00:00:00 2001 From: Dennis Kao <ulysseskao@gmail.com> Date: Mon, 25 Nov 2013 09:47:07 +0800 Subject: [PATCH] update JarCollector from geotools 10.2 --- xdgnjobs/ximple-build/maven/jar-collector/src/main/java/com/ximple/eofms/maven/JarCollector.java | 23 +++++------------------ 1 files changed, 5 insertions(+), 18 deletions(-) diff --git a/xdgnjobs/ximple-build/maven/jar-collector/src/main/java/com/ximple/eofms/maven/JarCollector.java b/xdgnjobs/ximple-build/maven/jar-collector/src/main/java/com/ximple/eofms/maven/JarCollector.java index 2aeb460..e9fbf2b 100644 --- a/xdgnjobs/ximple-build/maven/jar-collector/src/main/java/com/ximple/eofms/maven/JarCollector.java +++ b/xdgnjobs/ximple-build/maven/jar-collector/src/main/java/com/ximple/eofms/maven/JarCollector.java @@ -72,13 +72,10 @@ * Gets the parent "target" directory. */ MavenProject parent = project; - while (parent.hasParent()) { parent = parent.getParent(); } - collectDirectory = parent.getBuild().getDirectory(); - /* * Now collects the JARs. */ @@ -98,22 +95,18 @@ * such file. Some modules use pom packaging, which do not produce any JAR file. */ final File jarFile = new File(outputDirectory, jarName + ".jar"); - if (!jarFile.isFile()) { return; } - /* * Get the "target" directory of the parent pom.xml and make sure it exists. */ File collect = new File(collectDirectory); - if (!collect.exists()) { if (!collect.mkdir()) { throw new MojoExecutionException("Failed to create target directory: " + collect.getAbsolutePath()); } } - if (collect.getCanonicalFile().equals(jarFile.getParentFile().getCanonicalFile())) { /* * The parent's directory is the same one than this module's directory. @@ -123,31 +116,27 @@ */ return; } - /* * Creates a "binaries" subdirectory inside the "target" directory. */ collect = new File(collect, SUB_DIRECTORY); - if (!collect.exists()) { if (!collect.mkdir()) { throw new MojoExecutionException("Failed to create binaries directory."); } } - - int count = 1; FileUtils.copyFileToDirectory(jarFile, collect); - Set<Artifact> dependencies = project.getDependencyArtifacts(); + Set<Artifact> dependencies = project.getDependencyArtifacts(); if (dependencies != null) { for (final Artifact artifact : dependencies) { - System.out.println("+++++++++++++++++++++++ DEP: " + artifact.getDependencyTrail()); + System.out.println("+++++++++++++++++++++++ DEP: " + artifact.getDependencyTrail()); final String scope = artifact.getScope(); if (scope != null && // Maven 2.0.6 bug? - (scope.equalsIgnoreCase(Artifact.SCOPE_COMPILE) || - scope.equalsIgnoreCase(Artifact.SCOPE_RUNTIME))) + (scope.equalsIgnoreCase(Artifact.SCOPE_COMPILE) || + scope.equalsIgnoreCase(Artifact.SCOPE_RUNTIME))) { final File file = artifact.getFile(); - if (!artifact.getGroupId().startsWith("com.ximple.eofms")) { + if (!artifact.getGroupId().startsWith("org.geotools")) { final File copy = new File(collect, file.getName()); if (copy.exists()) { /* @@ -164,7 +153,5 @@ } } } - - getLog().info("Copied " + count + " JAR to parent directory."); } } -- Gitblit v0.0.0-SNAPSHOT