archiver.setArchiver(jarArchiver);
archiver.setOutputFile(jarFile);
jarArchiver.addDirectory(outputDirectory, new String[]{"**/*.class"}, null);
MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
try {
archiver.createArchive(session, project, archive);
} catch (Exception e) {
throw new MojoExecutionException("Could not build the jar file", e);
}
mavenProjectHelper.attachArtifact(project, "jar", "classes", jarFile);