public void execute()

in src/main/java/org/apache/maven/plugins/ejb/EjbMojo.java [285:330]


    public void execute() throws MojoExecutionException {

        if (!sourceDirectory.exists()) {
            getLog().warn("The created EJB jar will be empty cause the " + sourceDirectory.getPath()
                    + " did not exist.");
            sourceDirectory.mkdirs();
        }

        File jarFile = generateEjb();

        if (hasClassifier()) {
            if (!isClassifierValid()) {
                String message = "The given classifier '" + getClassifier() + "' is not valid.";
                getLog().error(message);
                throw new MojoExecutionException(message);
            }

            // TODO: We should check the attached artifacts to be sure we don't attach
            // the same file twice...
            projectHelper.attachArtifact(project, EJB_TYPE, getClassifier(), jarFile);
        } else {
            if (projectHasAlreadySetAnArtifact()) {
                throw new MojoExecutionException("You have to use a classifier "
                        + "to attach supplemental artifacts to the project instead of replacing them.");
            }

            project.getArtifact().setFile(jarFile);
        }

        if (generateClient) {
            File clientJarFile = generateEjbClient();
            if (hasClientClassifier()) {
                if (!isClientClassifierValid()) {
                    String message = "The given client classifier '" + getClientClassifier() + "' is not valid.";
                    getLog().error(message);
                    throw new MojoExecutionException(message);
                }

                projectHelper.attachArtifact(project, EJB_CLIENT_TYPE, getClientClassifier(), clientJarFile);
            } else {
                // FIXME: This does not make sense, cause a classifier for the client should always exist otherwise
                // Failure!
                projectHelper.attachArtifact(project, "ejb-client", getClientClassifier(), clientJarFile);
            }
        }
    }