use of org.gradle.api.artifacts.maven.MavenPom in project gradle by gradle.
the class DefaultArtifactPomTest method writePom.
@Test
public void writePom() {
final MavenPom mavenPomMock = context.mock(MavenPom.class);
DefaultArtifactPom artifactPom = new DefaultArtifactPom(mavenPomMock);
final File somePomFile = new File(tmpDir.getTestDirectory(), "someDir/somePath");
context.checking(new Expectations() {
{
allowing(mavenPomMock).getArtifactId();
will(returnValue("artifactId"));
oneOf(mavenPomMock).writeTo(with(any(FileOutputStream.class)));
}
});
PublishArtifact artifact = artifactPom.writePom(somePomFile);
assertThat(artifact.getName(), equalTo("artifactId"));
assertThat(artifact.getType(), equalTo("pom"));
assertThat(artifact.getExtension(), equalTo("pom"));
assertThat(artifact.getClassifier(), nullValue());
assertThat(artifact.getFile(), equalTo(somePomFile));
}
use of org.gradle.api.artifacts.maven.MavenPom in project gradle by gradle.
the class MavenPluginConvention method pom.
/**
* Creates and configures a new {@link MavenPom}. The given closure is executed to configure the new POM instance.
*
* @param configureClosure The closure to use to configure the POM instance.
* @return The POM instance.
*/
public MavenPom pom(Closure configureClosure) {
Factory<MavenPom> pomFactory = mavenFactory.createMavenPomFactory(project.getConfigurations(), conf2ScopeMappings.getMappings(), project.getFileResolver());
MavenPom pom = pomFactory.create();
pom.setGroupId(project.getGroup().toString());
pom.setArtifactId(project.getName());
pom.setVersion(project.getVersion().toString());
return ConfigureUtil.configure(configureClosure, pom);
}
use of org.gradle.api.artifacts.maven.MavenPom in project gradle by gradle.
the class MavenPluginConvention method pom.
/**
* Creates and configures a new {@link MavenPom}. The given action is executed to configure the new POM instance.
*
* @param configureAction The action to use to configure the POM instance.
* @return The POM instance.
* @since 4.2
*/
public MavenPom pom(Action<? super MavenPom> configureAction) {
MavenPom pom = pom();
configureAction.execute(pom);
return pom;
}
Aggregations