本文整理了Java中org.gradle.api.Project.getVersion()
方法的一些代码示例,展示了Project.getVersion()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getVersion()
方法的具体详情如下:
包路径:org.gradle.api.Project
类名称:Project
方法名:getVersion
暂无
代码示例来源:origin: uber/okbuck
public String getMavenCoords() {
String group = getProject().getGroup().toString();
String id =
getProject().getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName();
String version = getProject().getVersion().toString();
return String.join(":", group, id, version);
}
代码示例来源:origin: gradle.plugin.com.palantir.gradle.gitversion/gradle-git-version
@Override
public void execute(Task task) {
System.out.println(project.getVersion());
}
});
代码示例来源:origin: org.shipkit/shipkit
private String determineVersion(Project project, File versionFile) {
if ("unspecified".equals(project.getVersion())) {
LOG.info("'project.version' is unspecified. Version will be set to '{}'. You can change it in '{}'.",
FALLBACK_INITIAL_VERSION, versionFile.getName());
return FALLBACK_INITIAL_VERSION;
} else {
LOG.lifecycle(" Configured '{}' version in '{}' file. Please remove 'version={}' setting from *.gradle file.",
project.getVersion(), versionFile.getName(), project.getVersion());
return project.getVersion().toString();
}
}
}
代码示例来源:origin: mockito/shipkit
private String determineVersion(Project project, File versionFile) {
if ("unspecified".equals(project.getVersion())) {
LOG.info("'project.version' is unspecified. Version will be set to '{}'. You can change it in '{}'.",
FALLBACK_INITIAL_VERSION, versionFile.getName());
return FALLBACK_INITIAL_VERSION;
} else {
LOG.lifecycle(" Configured '{}' version in '{}' file. Please remove 'version={}' setting from *.gradle file.",
project.getVersion(), versionFile.getName(), project.getVersion());
return project.getVersion().toString();
}
}
}
代码示例来源:origin: gradle.plugin.org.shipkit/shipkit
private String determineVersion(Project project){
if("unspecified".equals(project.getVersion()) ){
LOG.lifecycle(" BEWARE! 'project.version' is unspecified. Version will be set to '{}'. You can change it in '{}'.",
FALLBACK_INITIAL_VERSION, versionFile.getName());
return FALLBACK_INITIAL_VERSION;
} else{
LOG.lifecycle(" Initial project version in '{}' set to '{}' (taken from 'project.version' property).",
versionFile.getName(), project.getVersion());
return project.getVersion().toString();
}
}
代码示例来源:origin: gradle.plugin.com.s390x/gogradle
@SuppressWarnings("unchecked")
private List<String> renderArgs(List<String> args, Map<String, String> env) {
Map<String, Object> context = new HashMap<>(env);
context.put("PROJECT_NAME", project.getName());
context.put("PROJECT_VERSION", project.getVersion());
return args.stream().map(s -> render(s, context)).collect(Collectors.toList());
}
代码示例来源:origin: gradle.plugin.fi.evident.gradle.beanstalk/gradle-beanstalk-plugin
protected String getVersionLabel() {
String versionLabel = getProject().getVersion().toString();
if (versionLabel.endsWith("-SNAPSHOT")) {
String timeLabel = new SimpleDateFormat("yyyyMMdd'.'HHmmss").format(new Date());
versionLabel = versionLabel.replace("SNAPSHOT", timeLabel); // Append time to get unique version label
}
return deployment.getVersionPrefix() + versionLabel;
}
代码示例来源:origin: me.seeber.gradle/gradle-project-config
/**
* Get the project version
*
* @return Project version
*/
public String getVersion() {
return Validate.notNull(getProject().getVersion().toString());
}
代码示例来源:origin: gradle.plugin.me.seeber.gradle/gradle-project-config
/**
* Get the project version
*
* @return Project version
*/
public String getVersion() {
return Validate.notNull(getProject().getVersion().toString());
}
代码示例来源:origin: linkedin/pygradle
@OutputFile
public File getSdistOutput() {
Project project = getProject();
return new File(
getDistDir(),
String.format(
"%s-%s.tar.gz",
project.getName(),
// TODO: Is this replace here really necessary?
project.getVersion().toString().replace("_", "-")));
}
代码示例来源:origin: gradle.plugin.com.linkedin.pygradle/pygradle-plugin
@OutputFile
public File getSdistOutput() {
Project project = getProject();
return new File(
getDistDir(),
String.format(
"%s-%s.tar.gz",
project.getName(),
// TODO: Is this replace here really necessary?
project.getVersion().toString().replace("_", "-")));
}
代码示例来源:origin: org.shipkit/shipkit
/**
* Returns Git tag based on release configuration and project version
*/
public static String getTag(ShipkitConfiguration conf, Project project) {
return conf.getGit().getTagPrefix() + project.getVersion();
}
代码示例来源:origin: com.palantir.gradle.conjure/gradle-conjure
@Override
protected final Map<String, Supplier<Object>> requiredOptions(File file) {
return ImmutableMap.of(
"packageName", () -> getProject().getName(),
"packageVersion", () -> getProject().getVersion().toString(),
"productDependencies", () -> getProductDependencyFile().getAbsolutePath());
}
}
代码示例来源:origin: MinecraftForge/ForgeGradle
LiteModJson(Project project, String minecraftVersion, String revision)
{
this.project = project;
this.mcversion = this.minecraftVersion = minecraftVersion;
this.revision = revision;
this.name = project.getName();
this.displayName = project.hasProperty("displayName") ? project.property("displayName").toString() : project.getDescription();
this.version = project.getVersion().toString();
}
代码示例来源:origin: com.palantir.gradle.conjure/gradle-conjure
@Override
protected final Map<String, Supplier<Object>> requiredOptions(File file) {
return ImmutableMap.of(
"packageName", () -> getProject().getName(),
"packageVersion", () -> formatPythonVersion(getProject().getVersion().toString()));
}
代码示例来源:origin: gradle.plugin.com.github.kaklakariada.aws/aws-sam-gradle
private String calculateS3Key() {
final String version = getProject().getVersion().toString();
final String md5Checksum = getMD5Checksum(file);
return getProject().getName() + "/" + version + "/" + md5Checksum + "/" + file.getName();
}
代码示例来源:origin: gradle.plugin.com.s390x/gogradle
private String getRenderedOutputLocation(Os os, Arch arch) {
Map<String, Object> context = new HashMap<>(getEffectiveEnvironment(os, arch));
context.put("PROJECT_NAME", getProject().getName());
context.put("PROJECT_VERSION", getProject().getVersion());
return StringUtils.render(getOutputLocation(), context);
}
代码示例来源:origin: gradle.plugin.com.devtub.scramble/java-defaults-gradle-plugin
@Override
public void execute(Project project) {
JavaPluginConvention java = project.getConvention().getPlugin(JavaPluginConvention.class);
java.setSourceCompatibility("1.8");
java.setTargetCompatibility("1.8");
Map<String, String> jarManifest = new HashMap<>();
jarManifest.put("Implementation-Title", project.getName());
jarManifest.put("Implementation-Version", project.getVersion().toString());
Jar jar = (Jar) project.getTasks().getByName("jar");
jar.getManifest().attributes(jarManifest);
}
}
代码示例来源:origin: com.ca.apim.gateway/gateway-developer-plugin
private static BuildFullBundleTask createBuildFullBundleTask(@NotNull Project project, GatewayDeveloperPluginConfig pluginConfig, BuildDeploymentBundleTask buildDeploymentBundleTask) {
// Create build-full-bundle task
final BuildFullBundleTask buildFullBundleTask = project.getTasks().create(BUILD_FULL_BUNDLE, BuildFullBundleTask.class, t -> {
t.getEnvironmentConfig().set(pluginConfig.getEnvironmentConfig());
t.getDependencyBundles().setFrom(project.getConfigurations().getByName(BUNDLE_CONFIGURATION));
});
project.afterEvaluate(p ->
buildFullBundleTask.getOutputBundle().set(new File(pluginConfig.getBuiltEnvironmentBundleDir().getAsFile().get(), p.getName() + '-' + p.getVersion() + "-full.bundle")));
buildFullBundleTask.dependsOn(buildDeploymentBundleTask);
return buildFullBundleTask;
}
代码示例来源:origin: gradle.plugin.com.github.gradle-guides/gradle-site-plugin
private ProjectDescriptor deriveProjectDescription(Project project) {
ProjectDescriptor projectDescriptor = new ProjectDescriptor(project.getName(), project.getGroup().toString(), project.getDescription(), project.getVersion().toString(), new EnvironmentDescriptor(project.getGradle().getGradleVersion()));
addPluginDescription(project, projectDescriptor);
addTasksDescription(project, projectDescriptor);
addJavaDescription(project, projectDescriptor);
return projectDescriptor;
}
内容来源于网络,如有侵权,请联系作者删除!