public void execute()

in src/main/java/org/apache/maven/plugins/ear/GenerateApplicationXmlMojo.java [161:208]


    public void execute() throws MojoExecutionException, MojoFailureException {
        // Initializes ear modules
        super.execute();

        // Handle application.xml
        if (!generateApplicationXml) {
            getLog().debug("Generation of application.xml is disabled");
        } else {
            final JavaEEVersion javaEEVersion = JavaEEVersion.getJavaEEVersion(version);

            // Generate deployment descriptor and copy it to the build directory
            getLog().info("Generating application.xml");
            try {
                generateStandardDeploymentDescriptor(javaEEVersion);
            } catch (EarPluginException e) {
                throw new MojoExecutionException("Failed to generate application.xml", e);
            }

            try {
                FileUtils.copyFileToDirectory(
                        new File(generatedDescriptorLocation, "application.xml"),
                        new File(getWorkDirectory(), "META-INF"));
            } catch (IOException e) {
                throw new MojoExecutionException("Unable to copy application.xml to final destination", e);
            }
        }

        // Handle jboss-app.xml
        if (getJbossConfiguration() == null) {
            getLog().debug("Generation of jboss-app.xml is disabled");
        } else {
            // Generate deployment descriptor and copy it to the build directory
            getLog().info("Generating jboss-app.xml");
            try {
                generateJbossDeploymentDescriptor();
            } catch (EarPluginException e) {
                throw new MojoExecutionException("Failed to generate jboss-app.xml", e);
            }

            try {
                FileUtils.copyFileToDirectory(
                        new File(generatedDescriptorLocation, "jboss-app.xml"),
                        new File(getWorkDirectory(), "META-INF"));
            } catch (IOException e) {
                throw new MojoExecutionException("Unable to copy jboss-app.xml to final destination", e);
            }
        }
    }