本文整理了Java中org.apache.maven.archiver.MavenArchiver.setOutputFile()
方法的一些代码示例,展示了MavenArchiver.setOutputFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MavenArchiver.setOutputFile()
方法的具体详情如下:
包路径:org.apache.maven.archiver.MavenArchiver
类名称:MavenArchiver
方法名:setOutputFile
暂无
代码示例来源: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: 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: opoo/opoopress
MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver(jarArchiver);
archiver.setOutputFile(outputFile);
代码示例来源: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: gwt-maven-plugin/gwt-maven-plugin
archiver.setOutputFile( jarFile );
archive.setForced( false );
代码示例来源: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: org.apache.maven.plugins/maven-war-plugin
archiver.setOutputFile( targetFile );
archiver.getArchiver().addDirectory( classesDirectory );
archiver.createArchive( session, project, archiveConfiguration );
代码示例来源:origin: io.teecube.tic/tic-bw6
private void addApplication() throws ArchiverException, ManifestException, IOException, DependencyResolutionRequiredException, MojoExecutionException {
getLog().info("");
jarArchiver.addDirectory(metaInf, metaInf.getName() + File.separator); // add "target/META-INF/", already prepared by "prepare-application-meta"
mavenArchiver.setArchiver(jarArchiver);
mavenArchiver.setOutputFile(getOutputFile());
// Set the MANIFEST.MF to the JAR Archiver
jarArchiver.setManifest(manifest);
// Set the MANIFEST.MF to the Archive Configuration
archiveConfiguration.setManifestFile(manifest);
archiveConfiguration.setAddMavenDescriptor(true);
// create the Archive
mavenArchiver.createArchive(session, project, archiveConfiguration);
}
代码示例来源:origin: CoreMedia/jangaroo-tools
MavenArchiver mavenArchiver = new MavenArchiver();
mavenArchiver.setArchiver(archiver);
mavenArchiver.setOutputFile(jarFile);
try {
if (archive.getManifestFile() == null) {
代码示例来源:origin: testIT-LivingDoc/livingdoc-core
archiver.setOutputFile(jarFile);
代码示例来源:origin: tbroyer/gwt-maven-plugin
archiver.setOutputFile(jarFile);
代码示例来源: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: net.jangaroo/jangaroo-maven-plugin
MavenArchiver mavenArchiver = new MavenArchiver();
mavenArchiver.setArchiver(archiver);
mavenArchiver.setOutputFile(zipFile);
try {
if (archive.getManifestFile() == null) {
代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin
archiver.setOutputFile(outputFile);
代码示例来源:origin: net.jangaroo/jangaroo-maven-plugin
mavenArchiver.setOutputFile(jarFile);
try {
MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
代码示例来源: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
archiver.setOutputFile( jarFile );
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!