本文整理了Java中org.apache.maven.archiver.MavenArchiver.<init>()
方法的一些代码示例,展示了MavenArchiver.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MavenArchiver.<init>()
方法的具体详情如下:
包路径:org.apache.maven.archiver.MavenArchiver
类名称:MavenArchiver
方法名:<init>
暂无
代码示例来源:origin: spotify/dockerfile-maven
@Nonnull
protected File buildDockerInfoJar(@Nonnull Log log) throws MojoExecutionException {
final File jarFile = getJarFile(buildDirectory, finalName, classifier);
final MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver(jarArchiver);
archiver.setOutputFile(jarFile);
archive.setForced(forceCreation);
if (dockerInfoDirectory.exists()) {
final String prefix = getMetaSubdir();
archiver.getArchiver().addDirectory(dockerInfoDirectory, prefix);
} else {
log.warn("Docker info directory not created - Docker info JAR will be empty");
}
try {
archiver.createArchive(session, project, archive);
} catch (Exception e) {
throw new MojoExecutionException("Could not build Docker info JAR", e);
}
return jarFile;
}
代码示例来源:origin: stackoverflow.com
public void execute() throws MojoExecutionException, MojoFailureException {
try {
MavenArchiver mavenArchiver = new MavenArchiver();
ManifestConfiguration config = new ManifestConfiguration();
config.setAddClasspath(true);
Manifest manifest = mavenArchiver.getManifest(project, config);
String classPath = manifest.getMainAttributes().getValue("Class-Path");
getLog().debug(String.format("Setting the classpath property %s to %s",classpathVarName,classPath));
project.getProperties().put(classpathVarName, classPath);
} catch (DependencyResolutionRequiredException e) {
throw new MojoFailureException(e.getMessage());
} catch (ManifestException e) {
throw new MojoFailureException(e.getMessage());
}
}
代码示例来源:origin: com.yahoo.vespa/bundle-plugin
private void createArchive(File jarFile, JarArchiver jarArchiver) throws MojoExecutionException {
MavenArchiver mavenArchiver = new MavenArchiver();
mavenArchiver.setArchiver(jarArchiver);
mavenArchiver.setOutputFile(jarFile);
try {
mavenArchiver.createArchive(session, project, archiveConfiguration);
} catch (Exception e) {
throw new MojoExecutionException("Error creating archive " + jarFile.getName(), e);
}
}
代码示例来源:origin: jenkinsci/maven-hpi-plugin
/**
* Generates a manifest file to be included in the .hpi file
*/
protected void generateManifest(MavenArchiveConfiguration archive, File manifestFile) throws MojoExecutionException {
// create directory if it doesn't exist yet
if (!manifestFile.getParentFile().exists())
manifestFile.getParentFile().mkdirs();
getLog().info("Generating " + manifestFile);
MavenArchiver ma = new MavenArchiver();
ma.setOutputFile(manifestFile);
PrintWriter printWriter = null;
try {
Manifest mf = ma.getManifest(project, archive.getManifest());
Manifest.Section mainSection = mf.getMainSection();
setAttributes(mainSection);
printWriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(manifestFile), "UTF-8"));
mf.write(printWriter);
} catch (ManifestException e) {
throw new MojoExecutionException("Error preparing the manifest: " + e.getMessage(), e);
} catch (DependencyResolutionRequiredException e) {
throw new MojoExecutionException("Error preparing the manifest: " + e.getMessage(), e);
} catch (IOException e) {
throw new MojoExecutionException("Error preparing the manifest: " + e.getMessage(), e);
} finally {
IOUtil.close(printWriter);
}
}
代码示例来源:origin: io.teecube.tic/tic-bw6
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().info(Messages.APPLICATION_PACKAGING);
jarArchiver = new JarArchiver();
mavenArchiver = new MavenArchiver();
archiveConfiguration = new MavenArchiveConfiguration();
try {
addModules();
addApplication();
} catch (ArchiverException | ManifestException | IOException | DependencyResolutionRequiredException e) {
e.printStackTrace();
}
}
代码示例来源:origin: org.sonatype.tycho/maven-osgi-source-plugin
protected MavenArchiver createArchiver()
throws MojoExecutionException
{
MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver( jarArchiver );
if ( project.getBuild() != null )
{
List resources = project.getBuild().getResources();
for ( Iterator i = resources.iterator(); i.hasNext(); )
{
Resource r = (Resource) i.next();
if ( r.getDirectory().endsWith( "maven-shared-archive-resources" ) )
{
addDirectory( archiver.getArchiver(), new File( r.getDirectory() ), getCombinedIncludes( null ),
getCombinedExcludes( null ) );
}
}
}
return archiver;
}
代码示例来源:origin: opoo/opoopress
MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver(jarArchiver);
archiver.setOutputFile(outputFile);
代码示例来源:origin: gwt-maven-plugin/gwt-maven-plugin
MavenArchiver archiver = new MavenArchiver();
代码示例来源:origin: tbroyer/gwt-maven-plugin
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
warArchiver.setExpectWebXml(false);
File warFile = new File(outputDirectory, warName + ".war");
MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver(warArchiver);
archiver.setOutputFile(warFile);
archive.setForced(forceCreation);
try {
File prepackagedApp = new File(outputDirectory, warName);
if (prepackagedApp.exists()) {
warArchiver.addDirectory(prepackagedApp);
}
archiver.createArchive(session, project, archive);
} catch (Exception e) {
throw new MojoExecutionException("Error packaging GWT application", e);
}
project.getArtifact().setFile(warFile);
}
}
代码示例来源:origin: org.carewebframework/org.carewebframework.mvn.plugin.core
/**
* Creates the archive from data in the staging directory.
*
* @return The archive file.
* @throws Exception Unspecified exception.
*/
private File createArchive() throws Exception {
getLog().info("Creating archive.");
Artifact artifact = mavenProject.getArtifact();
String clsfr = noclassifier ? "" : ("-" + classifier);
String archiveName = artifact.getArtifactId() + "-" + artifact.getVersion() + clsfr + ".jar";
File jarFile = new File(mavenProject.getBuild().getDirectory(), archiveName);
MavenArchiver archiver = new MavenArchiver();
jarArchiver.addDirectory(stagingDirectory);
archiver.setArchiver(jarArchiver);
archiver.setOutputFile(jarFile);
archiver.createArchive(mavenSession, mavenProject, archiveConfig);
if (noclassifier) {
artifact.setFile(jarFile);
} else {
projectHelper.attachArtifact(mavenProject, jarFile, classifier);
}
FileUtils.deleteDirectory(stagingDirectory);
return jarFile;
}
代码示例来源:origin: CoreMedia/jangaroo-tools
public void execute()
throws MojoExecutionException {
File jarFile = new File(targetDir, finalName + "." + Types.JAVASCRIPT_EXTENSION);
MavenArchiver mavenArchiver = new MavenArchiver();
mavenArchiver.setArchiver(archiver);
mavenArchiver.setOutputFile(jarFile);
代码示例来源:origin: tbroyer/gwt-maven-plugin
File jarFile = new File(outputDirectory, finalName + ".jar");
MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver(jarArchiver);
archiver.setOutputFile(jarFile);
代码示例来源:origin: testIT-LivingDoc/livingdoc-core
File jarFile = getJarFile(outputDirectory, finalName, getClassifier());
MavenArchiver archiver = new MavenArchiver();
代码示例来源:origin: org.codehaus.tycho/maven-osgi-packaging-plugin
private File createPluginJar() throws MojoExecutionException {
try {
MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver(jarArchiver);
File pluginFile = new File(buildDirectory, finalName + ".jar");
if (pluginFile.exists()) {
pluginFile.delete();
}
BuildOutputJar dotOutputJar = pdeProject.getDotOutputJar();
if (dotOutputJar != null) {
archiver.getArchiver().addDirectory(dotOutputJar.getOutputDirectory());
}
String binIncludes = pdeProject.getBuildProperties().getProperty("bin.includes");
String binExcludes = pdeProject.getBuildProperties().getProperty("bin.excludes");
if (binIncludes != null) {
archiver.getArchiver().addFileSet(getFileSet(project.getBasedir(), toFilePattern(binIncludes), toFilePattern(binExcludes)));
}
File manifest = updateManifest();
if (manifest.exists()) {
archive.setManifestFile(manifest);
}
archiver.setOutputFile(pluginFile);
archiver.createArchive(project, archive);
return pluginFile;
} catch (Exception e) {
throw new MojoExecutionException("Error assembling JAR", e);
}
}
代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin
private File generateObrZip(File obrDir, File outputDirectory, String obrName) throws MojoExecutionException
MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver(jarArchiver);
File outputFile = new File(outputDirectory, obrName + ".obr");
代码示例来源:origin: net.jangaroo/jangaroo-maven-plugin
addFileSetFollowingSymLinks(archiver, fileSet);
MavenArchiver mavenArchiver = new MavenArchiver();
mavenArchiver.setArchiver(archiver);
mavenArchiver.setOutputFile(jarFile);
代码示例来源:origin: org.objectweb.fractal.cecilia/maven-car-plugin
/**
* Generates the CAR.
*/
public File createArchive() throws MojoExecutionException {
File jarFile = getJarFile(outputDirectory, finalName, getClassifier());
MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver(carArchiver);
archiver.setOutputFile(jarFile);
archive.setForced(forceCreation);
try {
File contentDirectory = getClassesDirectory();
if (!contentDirectory.exists()) {
getLog().warn(
"CAR will be empty - no content was marked for inclusion!");
} else {
archiver.getArchiver().addDirectory(contentDirectory, DEFAULT_INCLUDES,
DEFAULT_EXCLUDES);
}
archiver.createArchive(project, archive);
return jarFile;
} catch (Exception e) {
// TODO: improve error handling
throw new MojoExecutionException("Error assembling CAR", e);
}
}
代码示例来源:origin: org.apache.maven.plugins/maven-site-plugin
/**
* Method that creates the jar file.
*
* @param siteDirectory the directory where the site files are located
* @param jarFilename the filename of the created jar file
* @return a File object that contains the created jar file
* @throws ArchiverException
* @throws IOException
* @throws ManifestException
* @throws DependencyResolutionRequiredException
*/
private File createArchive( File siteDirectory, String jarFilename )
throws ArchiverException, IOException, ManifestException, DependencyResolutionRequiredException
{
File siteJar = new File( jarOutputDirectory, jarFilename );
MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver( this.jarArchiver );
archiver.setOutputFile( siteJar );
if ( !siteDirectory.isDirectory() )
{
getLog().warn( "JAR will be empty - no content was marked for inclusion !" );
}
else
{
archiver.getArchiver().addDirectory( siteDirectory, getArchiveIncludes(), getArchiveExcludes() );
}
archiver.createArchive( getSession(), getProject(), archive );
return siteJar;
}
代码示例来源:origin: org.apache.maven.plugins/maven-jar-plugin
MavenArchiver archiver = new MavenArchiver();
代码示例来源:origin: jenkinsci/maven-hpi-plugin
/**
* Generates the webapp according to the {@code mode} attribute.
*
* @throws IOException
* @throws ArchiverException
* @throws ManifestException
* @throws DependencyResolutionRequiredException
*
*/
private void performPackaging()
throws IOException, ArchiverException, ManifestException, DependencyResolutionRequiredException, MojoExecutionException {
// generate a manifest
File manifestFile = new File(getWebappDirectory(), "META-INF/MANIFEST.MF");
generateManifest(archive, manifestFile);
Manifest manifest = loadManifest(manifestFile);
// create a jar file to be used when other plugins depend on this plugin.
File jarFile = getOutputFile(".jar");
MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver(jarArchiver);
archiver.setOutputFile(jarFile);
jarArchiver.addConfiguredManifest(manifest);
jarArchiver.addDirectory(getClassesDirectory());
archiver.createArchive(project,archive);
projectHelper.attachArtifact(project, "jar", jarClassifier, jarFile);
}
内容来源于网络,如有侵权,请联系作者删除!