private File generateEjb()

in src/main/java/org/apache/maven/plugins/ejb/EjbMojo.java [338:386]


    private File generateEjb() throws MojoExecutionException {
        File jarFile = EjbHelper.getJarFile(outputDirectory, jarName, getClassifier());

        getLog().info("Building EJB " + jarName + " with EJB version " + ejbVersion);

        MavenArchiver archiver = new MavenArchiver();

        archiver.setArchiver(jarArchiver);

        archiver.setCreatedBy("Maven EJB Plugin", "org.apache.maven.plugins", "maven-ejb-plugin");

        archiver.setOutputFile(jarFile);

        // configure for Reproducible Builds based on outputTimestamp value
        archiver.configureReproducible(outputTimestamp);

        File deploymentDescriptor = new File(sourceDirectory, ejbJar);

        checkEJBVersionCompliance(deploymentDescriptor);

        try {
            List<String> defaultExcludes = Arrays.asList(ejbJar, "**/package.html");
            List<String> defaultIncludes = DEFAULT_INCLUDES_LIST;

            IncludesExcludes ie =
                    new IncludesExcludes(Collections.<String>emptyList(), excludes, defaultIncludes, defaultExcludes);

            archiver.getArchiver().addDirectory(sourceDirectory, ie.resultingIncludes(), ie.resultingExcludes());

            // FIXME: We should be able to filter more than just the deployment descriptor?
            if (deploymentDescriptor.exists()) {
                // EJB-34 Filter ejb-jar.xml
                if (filterDeploymentDescriptor) {
                    filterDeploymentDescriptor(deploymentDescriptor);
                }
                archiver.getArchiver().addFile(deploymentDescriptor, ejbJar);
            }

            // create archive
            archiver.createArchive(session, project, archive);
        } catch (ArchiverException | ManifestException | IOException | DependencyResolutionRequiredException e) {
            throw new MojoExecutionException("There was a problem creating the EJB archive: " + e.getMessage(), e);
        } catch (MavenFilteringException e) {
            throw new MojoExecutionException(
                    "There was a problem filtering the deployment descriptor: " + e.getMessage(), e);
        }

        return jarFile;
    }