org.gradle.api.tasks.bundling.Jar.getArchivePath()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.gradle.api.tasks.bundling.Jar.getArchivePath()方法的一些代码示例,展示了Jar.getArchivePath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jar.getArchivePath()方法的具体详情如下:
包路径:org.gradle.api.tasks.bundling.Jar
类名称:Jar
方法名:getArchivePath

Jar.getArchivePath介绍

暂无

代码示例

代码示例来源:origin: MinecraftForge/ForgeGradle

public File call()
  {
    return ((Jar) plugin.project.getTasks().getByName(jarName)).getArchivePath();
  }
};

代码示例来源:origin: gradle.plugin.com.enonic.xp/xp-gradle-plugin

@InputFile
public File getFrom()
{
  return ( (Jar) getProject().getTasks().getByPath( "jar" ) ).getArchivePath();
}

代码示例来源:origin: gradle.plugin.com.enonic.gradle/xp-gradle-plugin

@InputFile
public File getFrom()
{
  return ( (Jar) getProject().getTasks().getByPath( "jar" ) ).getArchivePath();
}

代码示例来源:origin: baratine/baratine

@Override
public void execute(Jar jar)
 File archiveFile = jar.getArchivePath();
 Path archivePath = archiveFile.toPath();

代码示例来源:origin: com.google.cloud.tools/appengine-gradle-plugin

@Override
 public void execute(Project project) {
  // we can only set the default location of "archive" after project evaluation (callback)
  if (stageExtension.getArtifact() == null) {
   if (project.getPlugins().hasPlugin(WarPlugin.class)) {
    War war = (War) project.getProperties().get("war");
    stageExtension.setArtifact(war.getArchivePath());
   } else if (project.getPlugins().hasPlugin(JavaPlugin.class)) {
    Jar jar = (Jar) project.getProperties().get("jar");
    stageExtension.setArtifact(jar.getArchivePath());
   } else {
    throw new GradleException("Could not find JAR or WAR configuration");
   }
  }
 }
});

代码示例来源:origin: gradle.plugin.org.avaje.boot/boot-gradle-plugin

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);
}

代码示例来源:origin: gradle.plugin.org.avaje.boot/boot-gradle-plugin

@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);
  }
}

代码示例来源:origin: diffplug/goomph

ZipMisc.modify(jarTask.getArchivePath(), toModify, Predicates.alwaysFalse());

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-wsdl-builder

private void _addTaskBuildWSDLTasks(
  BuildWSDLTask buildWSDLTask, File inputFile,
  Configuration wsdlBuilderConfiguration) {
  Project project = buildWSDLTask.getProject();
  if (buildWSDLTask.isBuildLibs()) {
    String tmpDirName =
      "build-wsdl/" + FileUtil.stripExtension(inputFile.getName());
    File tmpDir = new File(project.getBuildDir(), tmpDirName);
    File tmpSrcDir = new File(tmpDir, "src");
    Task generateTask = _addTaskBuildWSDLGenerate(
      buildWSDLTask, wsdlBuilderConfiguration, inputFile, tmpSrcDir,
      true);
    Task compileTask = _addTaskBuildWSDLCompile(
      buildWSDLTask, wsdlBuilderConfiguration, inputFile, tmpDir,
      generateTask);
    Jar jar = _addTaskBuildWSDLJar(
      buildWSDLTask, inputFile, compileTask, generateTask);
    buildWSDLTask.dependsOn(jar);
    TaskOutputs taskOutputs = buildWSDLTask.getOutputs();
    taskOutputs.file(jar.getArchivePath());
  }
  else {
    Task generateTask = _addTaskBuildWSDLGenerate(
      buildWSDLTask, wsdlBuilderConfiguration, inputFile,
      buildWSDLTask.getDestinationDir(), false);
    buildWSDLTask.dependsOn(generateTask);
  }
}

代码示例来源:origin: diffplug/goomph

@Override
protected FileSignature calculateState() throws Exception {
  Set<File> files = new LinkedHashSet<>();
  for (Object o : projConfigMaven) {
    if (o instanceof Project) {
      Project project = (Project) o;
      Jar jar = taskFor(project);
      files.add(jar.getArchivePath());
      files.addAll(project.getConfigurations().getByName(JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME).resolve());
    } else if (o instanceof Configuration) {
      Configuration config = (Configuration) o;
      files.addAll(config.resolve());
    } else if (o instanceof String) {
      String mavenCoord = (String) o;
      Dependency dep = setupTask.getProject().getDependencies().create(mavenCoord);
      files.addAll(setupTask.getProject().getConfigurations()
          .detachedConfiguration(dep)
          .setDescription(mavenCoord)
          .setTransitive(false)
          .resolve());
    } else {
      throw Unhandled.classException(o);
    }
  }
  return FileSignature.signAsList(files);
}

代码示例来源:origin: gradle.plugin.org.shipkit/shipkit

@TaskAction public void comparePublications() {
  if(previousVersion == null){
    getLogger().lifecycle("{} - previousVersion is not set, nothing to compare", getPath());
    publicationsEqual = false;
    return;
  }
  GenerateMavenPom pomTask = (GenerateMavenPom) getProject().getTasks().getByName(pomTaskName);
  //TODO let's add decent validation and descriptive error messages to the user
  assert pomTask.getDestination().isFile();
  assert sourcesJar.getArchivePath().isFile();
  File currentVersionPomFile = pomTask.getDestination();
  File currentVersionSourcesJarFile = sourcesJar.getArchivePath();
  getLogger().lifecycle("{} - about to compare publications, for versions {} and {}",
        getPath(), previousVersion, currentVersion);
  PomComparator pomComparator = new PomComparator(projectGroup, previousVersion, currentVersion);
  Diff pomsDiff = pomComparator.areEqual(previousVersionPomFile, currentVersionPomFile);
  getLogger().lifecycle("{} - pom files equal: {}", getPath(), pomsDiff.areFilesEqual());
  ZipComparator sourcesJarComparator = new ZipComparator();
  Diff jarsDiff = sourcesJarComparator.areEqual(previousVersionSourcesJarFile, currentVersionSourcesJarFile);
  getLogger().lifecycle("{} - source jars equal: {}", getPath(), jarsDiff.areFilesEqual());
  differences.add(jarsDiff);
  differences.add(pomsDiff);
  this.publicationsEqual = jarsDiff.areFilesEqual() && pomsDiff.areFilesEqual();
}

代码示例来源:origin: GoogleCloudPlatform/app-gradle-plugin

@Test
public void testDefaultConfigurationAlternative() {
 Project p =
   new TestProject(testProjectDir.getRoot()).addDockerDir().applyAppYamlProjectBuilder();
 AppEngineAppYamlExtension ext = p.getExtensions().getByType(AppEngineAppYamlExtension.class);
 StageAppYamlExtension stageExt = ext.getStage();
 assertTrue(new File(testProjectDir.getRoot(), "src/main/docker").exists());
 assertEquals((((Jar) p.getProperties().get("jar")).getArchivePath()), stageExt.getArtifact());
}

代码示例来源:origin: wildfly-swarm-archive/ARCHIVE-wildfly-swarm

.artifactResolvingHelper(new GradleArtifactResolvingHelper(project))
.projectArtifact(project.getGroup().toString(), project.getName(), project.getVersion().toString(),
         jarTask.getExtension(), jarTask.getArchivePath())
.mainClass(ext.getMainClassName())
.bundleDependencies(ext.getBundleDependencies())

代码示例来源:origin: GoogleCloudPlatform/app-gradle-plugin

} else if (project.getPlugins().hasPlugin(JavaPlugin.class)) {
 Jar jar = (Jar) project.getProperties().get("jar");
 stageExtension.setArtifact(jar.getArchivePath());
} else {
 throw new GradleException("Could not find JAR or WAR configuration");

代码示例来源:origin: org.shipkit/shipkit

public void comparePublications(ComparePublicationsTask task) {
  if (!task.getPreviousSourcesJar().exists()) {
    LOG.lifecycle("{} - previous publications not found, nothing to compare, skipping", task.getPath());
    return;
  }
  //TODO let's add decent validation and descriptive error messages to the user
  assert task.getSourcesJar().getArchivePath().isFile();
  File currentVersionSourcesJarFile = task.getSourcesJar().getArchivePath();
  LOG.lifecycle("{} - about to compare publications",
      task.getPath());
  Diff depInfoDiff = getDependencyInfoDiff(task, currentVersionSourcesJarFile);
  LOG.lifecycle("{} - {} files equal: {}", task.getPath(), DEPENDENCY_INFO_FILEPATH, depInfoDiff.areFilesEqual());
  ZipComparator sourcesJarComparator = new ZipComparator();
  Diff jarsDiff = sourcesJarComparator.areEqual(task.getPreviousSourcesJar(), currentVersionSourcesJarFile);
  LOG.lifecycle("{} - source jars equal: {}", task.getPath(), jarsDiff.areFilesEqual());
  String comparisonResult = new ComparePublicationsResultFormatter().formatResults(
    task.getPreviousSourcesJar(), currentVersionSourcesJarFile, jarsDiff, depInfoDiff);
  LOG.lifecycle("{} - You can find detailed publication comparison results in file {}.", task.getPath(), task.getComparisonResult());
  IOUtil.writeFile(task.getComparisonResult(), comparisonResult);
}

代码示例来源:origin: mockito/shipkit

public void comparePublications(ComparePublicationsTask task) {
  if (!task.getPreviousSourcesJar().exists()) {
    LOG.lifecycle("{} - previous publications not found, nothing to compare, skipping", task.getPath());
    return;
  }
  //TODO let's add decent validation and descriptive error messages to the user
  assert task.getSourcesJar().getArchivePath().isFile();
  File currentVersionSourcesJarFile = task.getSourcesJar().getArchivePath();
  LOG.lifecycle("{} - about to compare publications",
      task.getPath());
  Diff depInfoDiff = getDependencyInfoDiff(task, currentVersionSourcesJarFile);
  LOG.lifecycle("{} - {} files equal: {}", task.getPath(), DEPENDENCY_INFO_FILEPATH, depInfoDiff.areFilesEqual());
  ZipComparator sourcesJarComparator = new ZipComparator();
  Diff jarsDiff = sourcesJarComparator.areEqual(task.getPreviousSourcesJar(), currentVersionSourcesJarFile);
  LOG.lifecycle("{} - source jars equal: {}", task.getPath(), jarsDiff.areFilesEqual());
  String comparisonResult = new ComparePublicationsResultFormatter().formatResults(
    task.getPreviousSourcesJar(), currentVersionSourcesJarFile, jarsDiff, depInfoDiff);
  LOG.lifecycle("{} - You can find detailed publication comparison results in file {}.", task.getPath(), task.getComparisonResult());
  IOUtil.writeFile(task.getComparisonResult(), comparisonResult);
}

代码示例来源:origin: MinecraftForge/ForgeGradle

exec.classpath(project.getConfigurations().getByName(CONFIG_MC_DEPS));
exec.classpath(project.getConfigurations().getByName(CONFIG_START));
exec.classpath(jarTask.getArchivePath());
exec.dependsOn(jarTask);
exec.jvmArgs(getClientJvmArgs(getExtension()));
exec.classpath(project.getConfigurations().getByName(CONFIG_MC_DEPS));
exec.classpath(project.getConfigurations().getByName(CONFIG_START));
exec.classpath(jarTask.getArchivePath());
exec.dependsOn(jarTask);
exec.jvmArgs(getServerJvmArgs(getExtension()));

代码示例来源:origin: palantir/sls-packaging

jarTask.get().getArchivePath(), p.getConfigurations().getByName("runtimeClasspath")));
}));

相关文章