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

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

本文整理了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

  1. public File call()
  2. {
  3. return ((Jar) plugin.project.getTasks().getByName(jarName)).getArchivePath();
  4. }
  5. };

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

  1. @InputFile
  2. public File getFrom()
  3. {
  4. return ( (Jar) getProject().getTasks().getByPath( "jar" ) ).getArchivePath();
  5. }

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

  1. @InputFile
  2. public File getFrom()
  3. {
  4. return ( (Jar) getProject().getTasks().getByPath( "jar" ) ).getArchivePath();
  5. }

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

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

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

  1. @Override
  2. public void execute(Project project) {
  3. // we can only set the default location of "archive" after project evaluation (callback)
  4. if (stageExtension.getArtifact() == null) {
  5. if (project.getPlugins().hasPlugin(WarPlugin.class)) {
  6. War war = (War) project.getProperties().get("war");
  7. stageExtension.setArtifact(war.getArchivePath());
  8. } else if (project.getPlugins().hasPlugin(JavaPlugin.class)) {
  9. Jar jar = (Jar) project.getProperties().get("jar");
  10. stageExtension.setArtifact(jar.getArchivePath());
  11. } else {
  12. throw new GradleException("Could not find JAR or WAR configuration");
  13. }
  14. }
  15. }
  16. });

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

  1. private void setupInputOutputs(Jar jarTask, String classifier) {
  2. Logger logger = this.project.getLogger();
  3. logger.debug("Using classifier: " + classifier + " for task "
  4. + this.task.getName());
  5. File inputFile = jarTask.getArchivePath();
  6. String outputName = inputFile.getName();
  7. outputName = StringUtils.stripFilenameExtension(outputName) + "-" + classifier
  8. + "." + StringUtils.getFilenameExtension(outputName);
  9. File outputFile = new File(inputFile.getParentFile(), outputName);
  10. this.task.getInputs().file(jarTask);
  11. addLibraryDependencies(this.task);
  12. this.task.getOutputs().file(outputFile);
  13. this.task.setOutputFile(outputFile);
  14. }

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

  1. @Override
  2. public void execute(Jar jarTask) {
  3. if (!RepackageTask.this.isEnabled()) {
  4. getLogger().info("Repackage disabled");
  5. return;
  6. }
  7. Object withJarTask = RepackageTask.this.withJarTask;
  8. if (!isTaskMatch(jarTask, withJarTask)) {
  9. getLogger().info(
  10. "Jar task not repackaged (didn't match withJarTask): " + jarTask);
  11. return;
  12. }
  13. File file = jarTask.getArchivePath();
  14. if (file.exists()) {
  15. repackage(file);
  16. }
  17. }

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

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

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

  1. private void _addTaskBuildWSDLTasks(
  2. BuildWSDLTask buildWSDLTask, File inputFile,
  3. Configuration wsdlBuilderConfiguration) {
  4. Project project = buildWSDLTask.getProject();
  5. if (buildWSDLTask.isBuildLibs()) {
  6. String tmpDirName =
  7. "build-wsdl/" + FileUtil.stripExtension(inputFile.getName());
  8. File tmpDir = new File(project.getBuildDir(), tmpDirName);
  9. File tmpSrcDir = new File(tmpDir, "src");
  10. Task generateTask = _addTaskBuildWSDLGenerate(
  11. buildWSDLTask, wsdlBuilderConfiguration, inputFile, tmpSrcDir,
  12. true);
  13. Task compileTask = _addTaskBuildWSDLCompile(
  14. buildWSDLTask, wsdlBuilderConfiguration, inputFile, tmpDir,
  15. generateTask);
  16. Jar jar = _addTaskBuildWSDLJar(
  17. buildWSDLTask, inputFile, compileTask, generateTask);
  18. buildWSDLTask.dependsOn(jar);
  19. TaskOutputs taskOutputs = buildWSDLTask.getOutputs();
  20. taskOutputs.file(jar.getArchivePath());
  21. }
  22. else {
  23. Task generateTask = _addTaskBuildWSDLGenerate(
  24. buildWSDLTask, wsdlBuilderConfiguration, inputFile,
  25. buildWSDLTask.getDestinationDir(), false);
  26. buildWSDLTask.dependsOn(generateTask);
  27. }
  28. }

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

  1. @Override
  2. protected FileSignature calculateState() throws Exception {
  3. Set<File> files = new LinkedHashSet<>();
  4. for (Object o : projConfigMaven) {
  5. if (o instanceof Project) {
  6. Project project = (Project) o;
  7. Jar jar = taskFor(project);
  8. files.add(jar.getArchivePath());
  9. files.addAll(project.getConfigurations().getByName(JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME).resolve());
  10. } else if (o instanceof Configuration) {
  11. Configuration config = (Configuration) o;
  12. files.addAll(config.resolve());
  13. } else if (o instanceof String) {
  14. String mavenCoord = (String) o;
  15. Dependency dep = setupTask.getProject().getDependencies().create(mavenCoord);
  16. files.addAll(setupTask.getProject().getConfigurations()
  17. .detachedConfiguration(dep)
  18. .setDescription(mavenCoord)
  19. .setTransitive(false)
  20. .resolve());
  21. } else {
  22. throw Unhandled.classException(o);
  23. }
  24. }
  25. return FileSignature.signAsList(files);
  26. }

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

  1. @TaskAction public void comparePublications() {
  2. if(previousVersion == null){
  3. getLogger().lifecycle("{} - previousVersion is not set, nothing to compare", getPath());
  4. publicationsEqual = false;
  5. return;
  6. }
  7. GenerateMavenPom pomTask = (GenerateMavenPom) getProject().getTasks().getByName(pomTaskName);
  8. //TODO let's add decent validation and descriptive error messages to the user
  9. assert pomTask.getDestination().isFile();
  10. assert sourcesJar.getArchivePath().isFile();
  11. File currentVersionPomFile = pomTask.getDestination();
  12. File currentVersionSourcesJarFile = sourcesJar.getArchivePath();
  13. getLogger().lifecycle("{} - about to compare publications, for versions {} and {}",
  14. getPath(), previousVersion, currentVersion);
  15. PomComparator pomComparator = new PomComparator(projectGroup, previousVersion, currentVersion);
  16. Diff pomsDiff = pomComparator.areEqual(previousVersionPomFile, currentVersionPomFile);
  17. getLogger().lifecycle("{} - pom files equal: {}", getPath(), pomsDiff.areFilesEqual());
  18. ZipComparator sourcesJarComparator = new ZipComparator();
  19. Diff jarsDiff = sourcesJarComparator.areEqual(previousVersionSourcesJarFile, currentVersionSourcesJarFile);
  20. getLogger().lifecycle("{} - source jars equal: {}", getPath(), jarsDiff.areFilesEqual());
  21. differences.add(jarsDiff);
  22. differences.add(pomsDiff);
  23. this.publicationsEqual = jarsDiff.areFilesEqual() && pomsDiff.areFilesEqual();
  24. }

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

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

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

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

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

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

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

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

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

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

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

  1. exec.classpath(project.getConfigurations().getByName(CONFIG_MC_DEPS));
  2. exec.classpath(project.getConfigurations().getByName(CONFIG_START));
  3. exec.classpath(jarTask.getArchivePath());
  4. exec.dependsOn(jarTask);
  5. exec.jvmArgs(getClientJvmArgs(getExtension()));
  6. exec.classpath(project.getConfigurations().getByName(CONFIG_MC_DEPS));
  7. exec.classpath(project.getConfigurations().getByName(CONFIG_START));
  8. exec.classpath(jarTask.getArchivePath());
  9. exec.dependsOn(jarTask);
  10. exec.jvmArgs(getServerJvmArgs(getExtension()));

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

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

相关文章