本文整理汇总了Java中org.gradle.api.publish.maven.MavenPublication类的典型用法代码示例。如果您正苦于以下问题:Java MavenPublication类的具体用法?Java MavenPublication怎么用?Java MavenPublication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MavenPublication类属于org.gradle.api.publish.maven包,在下文中一共展示了MavenPublication类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: apply
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
public void apply(final Project project) {
project.getPluginManager().apply(PublishingPlugin.class);
final TaskContainer tasks = project.getTasks();
final Task publishLocalLifecycleTask = tasks.create(PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);
publishLocalLifecycleTask.setDescription("Publishes all Maven publications produced by this project to the local Maven cache.");
publishLocalLifecycleTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
// Can't move this to rules yet, because it has to happen before user deferred configurable actions
project.getExtensions().configure(PublishingExtension.class, new Action<PublishingExtension>() {
public void execute(PublishingExtension extension) {
// Register factory for MavenPublication
extension.getPublications().registerFactory(MavenPublication.class, new MavenPublicationFactory(dependencyMetaDataProvider, instantiator, fileResolver));
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:MavenPublishPlugin.java
示例2: createMavenMarkerPublication
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
private void createMavenMarkerPublication(PluginDeclaration declaration, final MavenPublication coordinates, PublicationContainer publications) {
String pluginId = declaration.getId();
MavenPublication publication = publications.create(declaration.getName() + "PluginMarkerMaven", MavenPublication.class);
publication.setArtifactId(pluginId + PLUGIN_MARKER_SUFFIX);
publication.setGroupId(pluginId);
publication.getPom().withXml(new Action<XmlProvider>() {
@Override
public void execute(XmlProvider xmlProvider) {
Element root = xmlProvider.asElement();
Document document = root.getOwnerDocument();
Node dependencies = root.appendChild(document.createElement("dependencies"));
Node dependency = dependencies.appendChild(document.createElement("dependency"));
Node groupId = dependency.appendChild(document.createElement("groupId"));
groupId.setTextContent(coordinates.getGroupId());
Node artifactId = dependency.appendChild(document.createElement("artifactId"));
artifactId.setTextContent(coordinates.getArtifactId());
Node version = dependency.appendChild(document.createElement("version"));
version.setTextContent(coordinates.getVersion());
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:22,代码来源:MavenPluginPublishingRules.java
示例3: apply
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的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()))
);
}
开发者ID:freefair,项目名称:gradle-plugins,代码行数:22,代码来源:MavenPublishBasePlugin.java
示例4: apply
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
public void apply(final Project project) {
project.getPlugins().apply(PublishingPlugin.class);
final TaskContainer tasks = project.getTasks();
final Task publishLocalLifecycleTask = tasks.create(PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);
publishLocalLifecycleTask.setDescription("Publishes all Maven publications produced by this project to the local Maven cache.");
publishLocalLifecycleTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
// Can't move this to rules yet, because it has to happen before user deferred configurable actions
project.getExtensions().configure(PublishingExtension.class, new Action<PublishingExtension>() {
public void execute(PublishingExtension extension) {
// Register factory for MavenPublication
extension.getPublications().registerFactory(MavenPublication.class, new MavenPublicationFactory(dependencyMetaDataProvider, instantiator, fileResolver));
}
});
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:17,代码来源:MavenPublishPlugin.java
示例5: apply
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
public void apply(final Project project) {
project.getPlugins().apply(PublishingPlugin.class);
final TaskContainer tasks = project.getTasks();
final Task publishLifecycleTask = tasks.getByName(PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME);
final Task publishLocalLifecycleTask = tasks.create(PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);
publishLocalLifecycleTask.setDescription("Publishes all Maven publications produced by this project to the local Maven cache.");
publishLocalLifecycleTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
// Can't move this to rules yet, because it has to happen before user deferred configurable actions
project.getExtensions().configure(PublishingExtension.class, new Action<PublishingExtension>() {
public void execute(PublishingExtension extension) {
// Register factory for MavenPublication
extension.getPublications().registerFactory(MavenPublication.class, new MavenPublicationFactory(dependencyMetaDataProvider, instantiator, fileResolver));
}
});
modelRules.rule(new MavenPublishTaskModelRule(project, publishLifecycleTask, publishLocalLifecycleTask));
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:20,代码来源:MavenPublishPlugin.java
示例6: toPublicationInternal
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
private static MavenPublicationInternal toPublicationInternal(MavenPublication publication) {
if (publication == null) {
return null;
} else if (publication instanceof MavenPublicationInternal) {
return (MavenPublicationInternal) publication;
} else {
throw new InvalidUserDataException(
String.format(
"publication objects must implement the '%s' interface, implementation '%s' does not",
MavenPublicationInternal.class.getName(),
publication.getClass().getName()
)
);
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:AbstractPublishToMaven.java
示例7: create
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
public MavenPublication create(final String name) {
Module module = dependencyMetaDataProvider.getModule();
MavenProjectIdentity projectIdentity = new DefaultMavenProjectIdentity(module.getGroup(), module.getName(), module.getVersion());
NotationParser<Object, MavenArtifact> artifactNotationParser = new MavenArtifactNotationParserFactory(instantiator, fileResolver).create();
return instantiator.newInstance(
DefaultMavenPublication.class,
name, projectIdentity, artifactNotationParser, instantiator, projectDependencyResolver, fileCollectionFactory
);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:MavenPublishPlugin.java
示例8: addMarkerPublications
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
@Finalize
public void addMarkerPublications(PublishingExtension publishing, GradlePluginDevelopmentExtension pluginDevelopment) {
if (!pluginDevelopment.isAutomatedPublishing()) {
return;
}
PublicationContainer publications = publishing.getPublications();
NamedDomainObjectContainer<PluginDeclaration> declaredPlugins = pluginDevelopment.getPlugins();
for (PluginDeclaration declaration : declaredPlugins) {
createMavenMarkerPublication(declaration, (MavenPublication) publications.getByName("pluginMaven"), publications);
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:MavenPluginPublishingRules.java
示例9: customizePom
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
/**
* Customizes the pom. The method requires following properties on root project to function correctly:
*/
public static void customizePom(final Project project, final ShipkitConfiguration conf, final MavenPublication publication) {
publication.getPom().withXml(new Action<XmlProvider>() {
public void execute(XmlProvider xml) {
String archivesBaseName = (String) project.getProperties().get("archivesBaseName");
File contributorsFile = contributorsFile(project);
LOG.info(" Read project contributors from file: " + contributorsFile.getAbsolutePath());
// It can happens that contributorsFile doesn't exist e.g. when shipkit.team.contributors is NOT empty
ProjectContributorsSet contributorsFromGitHub = new ProjectContributorsSerializer()
.deserialize(IOUtil.readFullyOrDefault(contributorsFile, "[]"));
LOG.info(" Customizing pom for publication " + publication.getName() + " in " + project.toString() +
"\n - Module name (project.archivesBaseName): " + archivesBaseName +
"\n - Description (project.description): " + project.getDescription() +
"\n - GitHub repository (project.rootProject.shipkit.gitHub.repository): "
+ conf.getGitHub().getRepository() +
"\n - Developers (project.rootProject.shipkit.team.developers): "
+ StringUtil.join(conf.getTeam().getDevelopers(), ", ") +
"\n - Contributors (project.rootProject.shipkit.team.contributors): "
+ StringUtil.join(conf.getTeam().getContributors(), ", ") +
"\n - Contributors read from GitHub: "
+ StringUtil.join(contributorsFromGitHub.toConfigNotation(), ", "));
customizePom(xml.asNode(), conf, archivesBaseName, project.getDescription(), contributorsFromGitHub);
}
});
}
开发者ID:mockito,项目名称:shipkit,代码行数:30,代码来源:PomCustomizer.java
示例10: create
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
public MavenPublication create(final String name) {
Module module = dependencyMetaDataProvider.getModule();
MavenProjectIdentity projectIdentity = new DefaultMavenProjectIdentity(module.getGroup(), module.getName(), module.getVersion());
NotationParser<Object, MavenArtifact> artifactNotationParser = new MavenArtifactNotationParserFactory(instantiator, fileResolver).create();
return instantiator.newInstance(
DefaultMavenPublication.class,
name, projectIdentity, artifactNotationParser, instantiator, projectDependencyResolver
);
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:12,代码来源:MavenPublishPlugin.java
示例11: findMainPublication
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
private static @Nullable MavenPublication findMainPublication(Project project) {
ensureMavenPublishPlugin(project);
val publishing = project.getConvention().getByType(PublishingExtension.class);
val publications = publishing.getPublications();
return (MavenPublication)publications.findByName(PUBLICATION_NAME);
}
开发者ID:jdigger,项目名称:gradle-defaults,代码行数:9,代码来源:MavenPublishPublications.java
示例12: registerArtifacts
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
private void registerArtifacts(Project project, MavenPublication publication) {
val mainJarTask = (Jar)project.getTasks().getByName("jar");
addArtifactToPublication(publication, mainJarTask);
addArtifactToArchives(project, mainJarTask);
addArtifactToPublication(publication, sourcesJarTask(project));
addArtifactToArchives(project, sourcesJarTask(project));
val docJarTask = docJarTask(project);
if (docJarTask != null) {
addArtifactToPublication(publication, docJarTask);
addArtifactToArchives(project, docJarTask);
}
}
开发者ID:jdigger,项目名称:gradle-defaults,代码行数:15,代码来源:AbstractLanguagePlugin.java
示例13: addArtifactToPublication
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
private static void addArtifactToPublication(MavenPublication publication, Jar jarTask) {
val hasArtifactAlready = publication.getArtifacts().
stream().
anyMatch(artifact -> jarTask.getOutputs().getFiles().contains(artifact.getFile()));
if (!hasArtifactAlready) {
publication.artifact(jarTask);
}
}
开发者ID:jdigger,项目名称:gradle-defaults,代码行数:9,代码来源:AbstractLanguagePlugin.java
示例14: createMavenPluginPublication
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
private void createMavenPluginPublication(SoftwareComponent component, PublicationContainer publications) {
MavenPublication publication = publications.create("pluginMaven", MavenPublication.class);
publication.from(component);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:MavenPluginPublishingRules.java
示例15: createPublications
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
/**
* Create the default Maven publication
*
* @param publishingExtension Publishing extension where the publication is created
* @param projectContext Project context to access project information
* @param projectConfig Project configuration
* @param mavenConfig Maven configuration
* @param configurations Container to access configurations
* @param services Service manager to obtain service objects
*/
@Mutate
public void createPublications(PublishingExtension publishingExtension, ProjectContext projectContext,
ProjectConfig projectConfig, MavenConfig mavenConfig, ConfigurationContainer configurations,
ServiceRegistry services) {
SoftwareComponentContainer components = services.get(SoftwareComponentContainer.class);
JavaLibrary javaComponent = components.withType(JavaLibrary.class).getByName("java");
for (MavenPublicationConfig publicationConfig : mavenConfig.getPublications()) {
Configuration configuration = configurations
.getByName(publicationConfig.getArchivesConfiguration());
publishingExtension.getPublications().create(publicationConfig.getName(), MavenPublication.class,
p -> {
p.setArtifactId(publicationConfig.getArtifactId());
List<@NonNull Configuration> runtimeConfigurations = publicationConfig
.getRuntimeConfigurations().stream().map(c -> configurations.getByName(c))
.collect(Collectors.toList());
List<@NonNull Configuration> compileConfigurations = publicationConfig
.getCompileConfigurations().stream().map(c -> configurations.getByName(c))
.collect(Collectors.toList());
List<@NonNull PublishArtifact> artifacts = Collections.emptyList();
if (publicationConfig.isAddProjectArtifacts()) {
artifacts = javaComponent.getUsages().stream()
.flatMap(u -> u.getArtifacts().stream()).collect(Collectors.toList());
}
PomConfigurator configurator = new PomConfigurator(projectContext, projectConfig,
Validate.notNull(runtimeConfigurations),
Validate.notNull(compileConfigurations));
p.pom(pom -> pom.withXml(xml -> configurator.configurePom(Validate.notNull(xml))));
for (PublishArtifact a : configuration.getArtifacts()) {
p.artifact(a);
}
});
}
}
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:53,代码来源:MavenConfigPlugin.java
示例16: mainPublication
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
/**
* Gets (creating, if needed) the "main" publication.
*/
public static MavenPublication mainPublication(Project project) {
val pub = findMainPublication(project);
return (pub == null) ? createMainPublication(project) : pub;
}
开发者ID:jdigger,项目名称:gradle-defaults,代码行数:8,代码来源:MavenPublishPublications.java
示例17: configPom
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
private static void configPom(Project project, MavenPublication pub) {
pub.pom(pom -> pom.withXml(xmlProvider -> configPom(project, xmlProvider)));
}
开发者ID:jdigger,项目名称:gradle-defaults,代码行数:4,代码来源:MavenPublishPublications.java
示例18: createMainPublication
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
private static MavenPublication createMainPublication(Project project) {
val publishing = project.getConvention().getByType(PublishingExtension.class);
val pub = publishing.getPublications().create(PUBLICATION_NAME, MavenPublication.class);
publishing.getRepositories().mavenLocal();
project.afterEvaluate(prj -> groupid(project, (MavenPomInternal)pub.getPom()));
configPom(project, pub);
return pub;
}
开发者ID:jdigger,项目名称:gradle-defaults,代码行数:13,代码来源:MavenPublishPublications.java
示例19: getPublication
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
/**
* The publication to be published.
*
* @return The publication to be published
*/
@Internal
public MavenPublication getPublication() {
return publication;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:AbstractPublishToMaven.java
示例20: setPublication
import org.gradle.api.publish.maven.MavenPublication; //导入依赖的package包/类
/**
* Sets the publication to be published.
*
* @param publication The publication to be published
*/
public void setPublication(MavenPublication publication) {
this.publication = toPublicationInternal(publication);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:AbstractPublishToMaven.java
注:本文中的org.gradle.api.publish.maven.MavenPublication类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论