From fc9880cd77a09dcfdea2791dee418f54f5721cf3 Mon Sep 17 00:00:00 2001 From: Dennis Kao <ulysseskao@ximple.com.tw> Date: Wed, 05 Jun 2013 11:32:43 +0800 Subject: [PATCH] update JarCollector --- xdgnjobs/ximple-build/maven/jar-collector/src/main/java/com/ximple/eofms/maven/JarCollector.java | 49 +++++++++++++++++++++---------------------------- 1 files changed, 21 insertions(+), 28 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 ecd6b30..2aeb460 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 @@ -55,14 +55,6 @@ private String jarName; /** - * Project dependencies. - * - * @parameter expression="${project.artifacts}" - * @required - */ - private Set /*<Artifact>*/ dependencies; - - /** * The Maven project running this plugin. * * @parameter expression="${project}" @@ -118,7 +110,7 @@ if (!collect.exists()) { if (!collect.mkdir()) { - throw new MojoExecutionException("Failed to create target directory."); + throw new MojoExecutionException("Failed to create target directory: " + collect.getAbsolutePath()); } } @@ -145,29 +137,30 @@ int count = 1; FileUtils.copyFileToDirectory(jarFile, collect); - + Set<Artifact> dependencies = project.getDependencyArtifacts(); if (dependencies != null) { - for (final Iterator it = dependencies.iterator(); it.hasNext();) { - final Artifact artifact = (Artifact) it.next(); + for (final Artifact artifact : dependencies) { + 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))) { + if (scope != null && // Maven 2.0.6 bug? + (scope.equalsIgnoreCase(Artifact.SCOPE_COMPILE) || + scope.equalsIgnoreCase(Artifact.SCOPE_RUNTIME))) + { final File file = artifact.getFile(); - final File copy = new File(collect, file.getName()); - - if (!copy.exists()) { - /* - * Copies the dependency only if it was not already copied. Note that - * the module's JAR was copied inconditionnaly above (because it may - * be the result of a new compilation). If a Geotools JAR from the - * dependencies list changed, it will be copied inconditionnaly when - * the module for this JAR will be processed by Maven. - */ - FileUtils.copyFileToDirectory(file, collect); - count++; + if (!artifact.getGroupId().startsWith("com.ximple.eofms")) { + final File copy = new File(collect, file.getName()); + if (copy.exists()) { + /* + * Copies the dependency only if it was not already copied. Note that + * the module's JAR was copied inconditionnaly above (because it may + * be the result of a new compilation). If a Geotools JAR from the + * dependencies list changed, it will be copied inconditionnaly when + * the module for this JAR will be processed by Maven. + */ + continue; + } } + FileUtils.copyFileToDirectory(file, collect); } } } -- Gitblit v0.0.0-SNAPSHOT