public void performPackaging()

in src/main/java/org/apache/maven/plugins/war/packaging/ArtifactsPackagingTask.java [73:131]


    public void performPackaging(WarPackagingContext context) throws MojoExecutionException {
        try {
            final ScopeArtifactFilter filter = new ScopeArtifactFilter(Artifact.SCOPE_RUNTIME);
            final List<String> duplicates = findDuplicates(context, artifacts);

            for (Artifact artifact : artifacts) {
                String targetFileName = getArtifactFinalName(context, artifact);

                context.getLog().debug("Processing: " + targetFileName);

                if (duplicates.contains(targetFileName)) {
                    context.getLog().debug("Duplicate found: " + targetFileName);
                    targetFileName = artifact.getGroupId() + "-" + targetFileName;
                    context.getLog().debug("Renamed to: " + targetFileName);
                }
                context.getWebappStructure().registerTargetFileName(artifact, targetFileName);

                if (!artifact.isOptional() && filter.include(artifact)) {
                    try {
                        String type = artifact.getType();
                        if ("tld".equals(type)) {
                            copyFile(id, context, artifact.getFile(), TLD_PATH + targetFileName);
                        } else if ("aar".equals(type)) {
                            copyFile(id, context, artifact.getFile(), SERVICES_PATH + targetFileName);
                        } else if ("mar".equals(type)) {
                            copyFile(id, context, artifact.getFile(), MODULES_PATH + targetFileName);
                        } else if ("xar".equals(type)) {
                            copyFile(id, context, artifact.getFile(), EXTENSIONS_PATH + targetFileName);
                        } else if ("jar".equals(type)
                                || "ejb".equals(type)
                                || "ejb-client".equals(type)
                                || "test-jar".equals(type)
                                || "bundle".equals(type)) {
                            copyFile(id, context, artifact.getFile(), LIB_PATH + targetFileName);
                        } else if ("par".equals(type)) {
                            targetFileName = targetFileName.substring(0, targetFileName.lastIndexOf('.')) + ".jar";
                            copyFile(id, context, artifact.getFile(), LIB_PATH + targetFileName);
                        } else if ("war".equals(type)) {
                            // Nothing to do here, it is an overlay and it's already handled
                            context.getLog()
                                    .debug("war artifacts are handled as overlays, ignoring [" + artifact + "]");
                        } else if ("zip".equals(type)) {
                            // Nothing to do here, it is an overlay and it's already handled
                            context.getLog()
                                    .debug("zip artifacts are handled as overlays, ignoring [" + artifact + "]");
                        } else {
                            context.getLog()
                                    .debug("Artifact of type [" + type + "] is not supported, ignoring [" + artifact
                                            + "]");
                        }
                    } catch (IOException e) {
                        throw new MojoExecutionException("Failed to copy file for artifact [" + artifact + "]", e);
                    }
                }
            }
        } catch (InterpolationException e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
    }