本文整理汇总了Java中org.gradle.api.publish.maven.plugins.MavenPublishPlugin类的典型用法代码示例。如果您正苦于以下问题:Java MavenPublishPlugin类的具体用法?Java MavenPublishPlugin怎么用?Java MavenPublishPlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MavenPublishPlugin类属于org.gradle.api.publish.maven.plugins包,在下文中一共展示了MavenPublishPlugin类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; //导入依赖的package包/类
@Override
public void apply(Project project) {
this.project = project;
project.getPlugins().apply(getPluginClass());
project.getPlugins().apply(MavenPublishPlugin.class);
publication = project.getExtensions().getByType(PublishingExtension.class)
.getPublications()
.create(getPublicationName(), MavenPublication.class);
publication.from(getSoftwareComponent());
project.getPlugins().withType(SourcesJarPlugin.class, sourcesJarPlugin ->
publication.artifact(sourcesJarPlugin.getJarTask(), a -> a.setClassifier(sourcesJarPlugin.getClassifier()))
);
project.getPlugins().withType(JavadocJarPlugin.class, javadocJarPlugin ->
publication.artifact(javadocJarPlugin.getJarTask(), a -> a.setClassifier(javadocJarPlugin.getClassifier()))
);
}
示例2: createInstallTask
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; //导入依赖的package包/类
/**
* Create the install task from the Maven configuration
*
* @param tasks Task model to create task in
*/
@Mutate
public void createInstallTask(ModelMap<Task> tasks) {
tasks.create("install", Task.class, t -> {
t.setDescription("Install to local repository, convenience alias for 'publishToMavenLocal'");
t.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
t.dependsOn(MavenPublishPlugin.PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);
});
}
示例3: initialize
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; //导入依赖的package包/类
/**
* @see me.seeber.gradle.plugin.AbstractProjectConfigPlugin#initialize()
*/
@Override
public void initialize() {
getProject().getPlugins().apply(ProjectConfigPlugin.class);
getProject().getPlugins().apply(MavenPublishPlugin.class);
getProject().getPluginManager().withPlugin("java", p -> {
getProject().getPluginManager().apply(MavenJavaRules.class);
});
}
示例4: apply
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; //导入依赖的package包/类
@Override
public void apply(Project project) {
project.getPlugins().apply(StdModulePlugin.class);
final StdPluginExtension extension = project.getExtensions().create("stdplugin", StdPluginExtension.class, project);
// Gradle
project.getPlugins().apply(JavaGradlePluginPlugin.class);
project.getRepositories().add(project.getRepositories().jcenter());
// project.getDependencies().add(JavaPlugin.COMPILE_CONFIGURATION_NAME, project.getDependencies().gradleApi());
// project.getDependencies().add(JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME, project.getDependencies().gradleTestKit());
// Maven
project.getPlugins().apply(MavenPublishPlugin.class);
// Bintray
/*
project.getPlugins().apply(BintrayPlugin.class);
BintrayExtension bintray = project.getExtensions().getByType(BintrayExtension.class);
String bintrayUsername = StdProjectPlugin.getExtraPropertyOrNull(project.getRootProject(), "bintrayUsername");
if (bintrayUsername != null)
bintray.setUser(bintrayUsername);
String bintrayApiKey = StdProjectPlugin.getExtraPropertyOrNull(project.getRootProject(), "bintrayApiKey");
if (bintrayApiKey != null)
bintray.setKey(bintrayApiKey);
bintray.getPkg().setRepo("gradle-plugins");
*/
// Plugin
final File pluginDescriptorDir = new File(project.getBuildDir(), "generated-resources/gradle-plugin");
Task generatePluginDescriptors = project.getTasks().create("generatePluginDescriptors", GeneratePluginDescriptors.class, new Action<GeneratePluginDescriptors>() {
@Override
public void execute(GeneratePluginDescriptors t) {
// t.setGroup("Build");
t.setDescription("Generates gradle plugin descriptors.");
t.setDestinationDir(pluginDescriptorDir);
t.conventionMapping("pluginImplementations", new Callable<Map<String, String>>() {
@Override
public Map<String, String> call() throws Exception {
return extension.implementations;
}
});
}
});
SourceSetContainer sourceSets = project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets();
sourceSets.getByName("main").getOutput().dir(Collections.<String, Object>singletonMap("builtBy", generatePluginDescriptors), pluginDescriptorDir);
}