| | |
| | | private String jarName; |
| | | |
| | | /** |
| | | * Project dependencies. |
| | | * |
| | | * @parameter expression="${project.artifacts}" |
| | | * @required |
| | | */ |
| | | private Set /*<Artifact>*/ dependencies; |
| | | |
| | | /** |
| | | * The Maven project running this plugin. |
| | | * |
| | | * @parameter expression="${project}" |
| | |
| | | |
| | | if (!collect.exists()) { |
| | | if (!collect.mkdir()) { |
| | | throw new MojoExecutionException("Failed to create target directory."); |
| | | throw new MojoExecutionException("Failed to create target directory: " + collect.getAbsolutePath()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | } |