本文整理汇总了Java中org.gradle.api.tasks.bundling.Jar.getArchivePath方法的典型用法代码示例。如果您正苦于以下问题:Java Jar.getArchivePath方法的具体用法?Java Jar.getArchivePath怎么用?Java Jar.getArchivePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.api.tasks.bundling.Jar
的用法示例。
在下文中一共展示了Jar.getArchivePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.gradle.api.tasks.bundling.Jar; //导入方法依赖的package包/类
@Override
public void execute(Jar jarTask) {
if (!RepackageTask.this.isEnabled()) {
getLogger().info("Repackage disabled");
return;
}
Object withJarTask = RepackageTask.this.withJarTask;
if (!isTaskMatch(jarTask, withJarTask)) {
getLogger().info(
"Jar task not repackaged (didn't match withJarTask): " + jarTask);
return;
}
File file = jarTask.getArchivePath();
if (file.exists()) {
repackage(file);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:RepackageTask.java
示例2: setupInputOutputs
import org.gradle.api.tasks.bundling.Jar; //导入方法依赖的package包/类
private void setupInputOutputs(Jar jarTask, String classifier) {
Logger logger = this.project.getLogger();
logger.debug("Using classifier: " + classifier + " for task "
+ this.task.getName());
File inputFile = jarTask.getArchivePath();
String outputName = inputFile.getName();
outputName = StringUtils.stripFilenameExtension(outputName) + "-" + classifier
+ "." + StringUtils.getFilenameExtension(outputName);
File outputFile = new File(inputFile.getParentFile(), outputName);
this.task.getInputs().file(jarTask);
addLibraryDependencies(this.task);
this.task.getOutputs().file(outputFile);
this.task.setOutputFile(outputFile);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:RepackagePluginFeatures.java
示例3: execute
import org.gradle.api.tasks.bundling.Jar; //导入方法依赖的package包/类
@Override
public void execute(Jar jar)
{
File archiveFile = jar.getArchivePath();
Path archivePath = archiveFile.toPath();
String name = archiveFile.getName();
File parent = archiveFile.getParentFile().getAbsoluteFile();
int p = name.lastIndexOf('.');
String prefix = name.substring(0, p);
String ext = name.substring(p);
String outName = prefix + "-boot" + ext;
Path outFile = parent.toPath().resolve(outName);
try (OutputStream fOs = Files.newOutputStream(outFile)) {
Manifest manifest = new Manifest();
Attributes attr = manifest.getMainAttributes();
attr.put(Attributes.Name.MANIFEST_VERSION, "1.0");
attr.putValue("Main-Class", BaratineBoot.class.getName());
attr.putValue("Boot-Main-Class", getMainClassName());
try (JarOutputStream zOs = new JarOutputStream(fOs, manifest)) {
zOs.setLevel(0);
ZipEntry entry = new ZipEntry("main/main.jar");
entry.setSize(archiveFile.length());
entry.setCompressedSize(archiveFile.length());
entry.setMethod(ZipEntry.STORED);
entry.setCrc(calculateCrc(archivePath));
zOs.putNextEntry(entry);
Files.copy(archivePath, zOs);
writeDependencies(zOs);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}