本文整理汇总了Java中org.gradle.api.internal.plugins.DefaultArtifactPublicationSet类的典型用法代码示例。如果您正苦于以下问题:Java DefaultArtifactPublicationSet类的具体用法?Java DefaultArtifactPublicationSet怎么用?Java DefaultArtifactPublicationSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultArtifactPublicationSet类属于org.gradle.api.internal.plugins包,在下文中一共展示了DefaultArtifactPublicationSet类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureConfigurations
import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet; //导入依赖的package包/类
private void configureConfigurations(final Project project) {
ConfigurationContainer configurations = project.getConfigurations();
project.setProperty("status", "integration");
Configuration archivesConfiguration = configurations.maybeCreate(Dependency.ARCHIVES_CONFIGURATION).
setDescription("Configuration for archive artifacts.");
configurations.maybeCreate(Dependency.DEFAULT_CONFIGURATION).
setDescription("Configuration for default artifacts.");
final DefaultArtifactPublicationSet defaultArtifacts = project.getExtensions().create(
"defaultArtifacts", DefaultArtifactPublicationSet.class, archivesConfiguration.getArtifacts()
);
configurations.all(new Action<Configuration>() {
public void execute(Configuration configuration) {
configuration.getArtifacts().all(new Action<PublishArtifact>() {
public void execute(PublishArtifact artifact) {
defaultArtifacts.addCandidate(artifact);
}
});
}
});
}
示例2: configureConfigurations
import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet; //导入依赖的package包/类
private void configureConfigurations(final Project project) {
ConfigurationContainer configurations = project.getConfigurations();
project.setProperty("status", "integration");
Configuration archivesConfiguration = configurations.create(Dependency.ARCHIVES_CONFIGURATION).
setDescription("Configuration for archive artifacts.");
configurations.create(Dependency.DEFAULT_CONFIGURATION).
setDescription("Configuration for default artifacts.");
final DefaultArtifactPublicationSet defaultArtifacts = project.getExtensions().create(
"defaultArtifacts", DefaultArtifactPublicationSet.class, archivesConfiguration.getArtifacts()
);
configurations.all(new Action<Configuration>() {
public void execute(Configuration configuration) {
configuration.getArtifacts().all(new Action<PublishArtifact>() {
public void execute(PublishArtifact artifact) {
defaultArtifacts.addCandidate(artifact);
}
});
}
});
}
示例3: configureArchivesAndComponent
import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet; //导入依赖的package包/类
private void configureArchivesAndComponent(final Project project, final JavaPluginConvention pluginConvention) {
Jar jar = project.getTasks().create(JAR_TASK_NAME, Jar.class);
jar.getManifest().from(pluginConvention.getManifest());
jar.setDescription("Assembles a jar archive containing the main classes.");
jar.setGroup(BasePlugin.BUILD_GROUP);
jar.from(pluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput());
jar.getMetaInf().from(new Callable() {
public Object call() throws Exception {
return pluginConvention.getMetaInf();
}
});
ArchivePublishArtifact jarArtifact = new ArchivePublishArtifact(jar);
Configuration runtimeConfiguration = project.getConfigurations().getByName(RUNTIME_CONFIGURATION_NAME);
runtimeConfiguration.getArtifacts().add(jarArtifact);
project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(jarArtifact);
project.getComponents().add(new JavaLibrary(jarArtifact, runtimeConfiguration.getAllDependencies()));
}
示例4: setupEarTask
import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet; //导入依赖的package包/类
private void setupEarTask(final Project project, EarPluginConvention convention) {
Ear ear = project.getTasks().create(EAR_TASK_NAME, Ear.class);
ear.setDescription("Generates a ear archive with all the modules, the application descriptor and the libraries.");
DeploymentDescriptor deploymentDescriptor = convention.getDeploymentDescriptor();
if (deploymentDescriptor != null) {
if (deploymentDescriptor.getDisplayName() == null) {
deploymentDescriptor.setDisplayName(project.getName());
}
if (deploymentDescriptor.getDescription() == null) {
deploymentDescriptor.setDescription(project.getDescription());
}
}
ear.setGroup(BasePlugin.BUILD_GROUP);
project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(new ArchivePublishArtifact(ear));
project.getTasks().withType(Ear.class, new Action<Ear>() {
public void execute(Ear task) {
task.getLib().from(new Callable<FileCollection>() {
public FileCollection call() throws Exception {
return project.getConfigurations().getByName(EARLIB_CONFIGURATION_NAME);
}
});
task.from(new Callable<FileCollection>() {
public FileCollection call() throws Exception {
// add the module configuration's files
return project.getConfigurations().getByName(DEPLOY_CONFIGURATION_NAME);
}
});
}
});
}
示例5: configureArchiveTask
import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet; //导入依赖的package包/类
private <T extends AbstractArchiveTask> Task configureArchiveTask(Project project, String taskName, final Distribution distribution, Class<T> type) {
final T archiveTask = project.getTasks().create(taskName, type);
archiveTask.setDescription("Bundles the project as a distribution.");
archiveTask.setGroup(DISTRIBUTION_GROUP);
archiveTask.getConventionMapping().map("baseName", new Callable<Object>() {
@Override
public Object call() throws Exception {
if (distribution.getBaseName() == null || distribution.getBaseName().equals("")) {
throw new GradleException("Distribution baseName must not be null or empty! Check your configuration of the distribution plugin.");
}
return distribution.getBaseName();
}
});
Callable<String> baseDir = new Callable<String>() {
@Override
public String call() throws Exception {
// For backwards compatibility, we need to simulate the exact behaviour of the previously uses Groovy minus operator
String toBeRenamedIfExists = "." + archiveTask.getExtension();
return archiveTask.getArchiveName().replaceFirst(toBeRenamedIfExists, "");
}
};
CopySpec childSpec = project.copySpec();
childSpec.into(baseDir);
childSpec.with(distribution.getContents());
archiveTask.with(childSpec);
ArchivePublishArtifact archiveArtifact = new ArchivePublishArtifact(archiveTask);
project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(archiveArtifact);
return archiveTask;
}
示例6: configureArchivesAndComponent
import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet; //导入依赖的package包/类
private void configureArchivesAndComponent(final Project project, final JavaPluginConvention pluginConvention) {
Jar jar = project.getTasks().create(JAR_TASK_NAME, Jar.class);
jar.setDescription("Assembles a jar archive containing the main classes.");
jar.setGroup(BasePlugin.BUILD_GROUP);
jar.from(pluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput());
ArchivePublishArtifact jarArtifact = new ArchivePublishArtifact(jar);
Configuration runtimeConfiguration = project.getConfigurations().getByName(RUNTIME_CONFIGURATION_NAME);
runtimeConfiguration.getArtifacts().add(jarArtifact);
project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(jarArtifact);
project.getComponents().add(new JavaLibrary(jarArtifact, runtimeConfiguration.getAllDependencies()));
}
示例7: apply
import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet; //导入依赖的package包/类
public void apply(final Project project) {
project.getPluginManager().apply(JavaPlugin.class);
final WarPluginConvention pluginConvention = new WarPluginConvention(project);
project.getConvention().getPlugins().put("war", pluginConvention);
project.getTasks().withType(War.class, new Action<War>() {
public void execute(War task) {
task.from(new Callable() {
public Object call() throws Exception {
return pluginConvention.getWebAppDir();
}
});
task.dependsOn(new Callable() {
public Object call() throws Exception {
return project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName(
SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
}
});
task.classpath(new Object[] {new Callable() {
public Object call() throws Exception {
FileCollection runtimeClasspath = project.getConvention().getPlugin(JavaPluginConvention.class)
.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
Configuration providedRuntime = project.getConfigurations().getByName(
PROVIDED_RUNTIME_CONFIGURATION_NAME);
return runtimeClasspath.minus(providedRuntime);
}
}});
}
});
War war = project.getTasks().create(WAR_TASK_NAME, War.class);
war.setDescription("Generates a war archive with all the compiled classes, the web-app content and the libraries.");
war.setGroup(BasePlugin.BUILD_GROUP);
ArchivePublishArtifact warArtifact = new ArchivePublishArtifact(war);
project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(warArtifact);
configureConfigurations(project.getConfigurations());
configureComponent(project, warArtifact);
}
示例8: apply
import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet; //导入依赖的package包/类
public void apply(final Project project) {
project.getPlugins().apply(JavaPlugin.class);
final WarPluginConvention pluginConvention = new WarPluginConvention(project);
project.getConvention().getPlugins().put("war", pluginConvention);
project.getTasks().withType(War.class, new Action<War>() {
public void execute(War task) {
task.from(new Callable() {
public Object call() throws Exception {
return pluginConvention.getWebAppDir();
}
});
task.dependsOn(new Callable() {
public Object call() throws Exception {
return project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName(
SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
}
});
task.classpath(new Object[] {new Callable() {
public Object call() throws Exception {
FileCollection runtimeClasspath = project.getConvention().getPlugin(JavaPluginConvention.class)
.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
Configuration providedRuntime = project.getConfigurations().getByName(
PROVIDED_RUNTIME_CONFIGURATION_NAME);
return runtimeClasspath.minus(providedRuntime);
}
}});
}
});
War war = project.getTasks().create(WAR_TASK_NAME, War.class);
war.setDescription("Generates a war archive with all the compiled classes, the web-app content and the libraries.");
war.setGroup(BasePlugin.BUILD_GROUP);
ArchivePublishArtifact warArtifact = new ArchivePublishArtifact(war);
project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(warArtifact);
configureConfigurations(project.getConfigurations());
configureComponent(project, warArtifact);
}
示例9: setupEarTask
import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet; //导入依赖的package包/类
/**
* Setup the NW EAR Task.
* Uses some magic to set up the default archive conventions, using the same name as the task (nwear).
* For example nwear.archiveName = ''
*/
private NWEar setupEarTask(final Project project, NWEarPluginConvention convention) {
NWEar ear = project.getTasks().create(NWEAR_TASK_NAME, NWEar.class);
ear.setDescription(NWEAR_TASK_DESC);
ear.setGroup(PLUGIN_GROUP);
project.getExtensions()
.getByType(DefaultArtifactPublicationSet.class)
.addCandidate(new ArchivePublishArtifact(ear));
return ear;
}