public void execute()

in src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java [297:326]


    public void execute() throws MojoException {
        if (useDefaultManifestFile) {
            throw new MojoException("You are using 'useDefaultManifestFile' which has been removed"
                    + " from the maven-jar-plugin. "
                    + "Please see the >>Major Version Upgrade to version 3.0.0<< on the plugin site.");
        }

        if (skipIfEmpty && isEmpty(getClassesDirectory())) {
            getLog().info("Skipping packaging of the " + getType());
        } else {
            Path jarFile = createArchive();
            ProducedArtifact artifact;
            if (hasClassifier()) {
                artifact = session.createProducedArtifact(
                        project.getGroupId(),
                        project.getArtifactId(),
                        project.getVersion(),
                        getClassifier(),
                        null,
                        getType());
            } else {
                if (projectHasAlreadySetAnArtifact()) {
                    throw new MojoException("You have to use a classifier "
                            + "to attach supplemental artifacts to the project instead of replacing them.");
                }
                artifact = project.getMainArtifact().get();
            }
            projectManager.attachArtifact(project, artifact, jarFile);
        }
    }