use of org.apache.maven.model.Build in project maven-plugins by apache.
the class ReactorMavenProjectStub method getModel.
public Model getModel() {
if (model == null) {
model = new Model();
model.setGroupId(getGroupId());
model.setArtifactId(getArtifactId());
model.setVersion(getVersion());
model.setPackaging(getPackaging());
model.setProperties(new Properties());
Build build = new Build();
build.setFinalName(getArtifactId() + "-" + getVersion() + "." + getPackaging());
if (parent != null) {
build.setDirectory(parent.getBasedir().getAbsolutePath() + "/" + getArtifactId() + "/target");
FileUtils.mkdir(build.getDirectory());
build.setOutputDirectory(parent.getBasedir().getAbsolutePath() + "/" + getArtifactId() + "/target/classes");
FileUtils.mkdir(build.getOutputDirectory());
build.setTestOutputDirectory(parent.getBasedir().getAbsolutePath() + "/" + getArtifactId() + "/target/test-classes");
FileUtils.mkdir(build.getTestOutputDirectory());
Reporting reporting = new Reporting();
reporting.setOutputDirectory(parent.getBasedir().getAbsolutePath() + "/" + getArtifactId() + "/target/site");
FileUtils.mkdir(reporting.getOutputDirectory());
model.setReporting(reporting);
}
model.setBuild(build);
}
return model;
}
use of org.apache.maven.model.Build in project maven-plugins by apache.
the class AssemblyExpressionEvaluatorTest method testShouldInterpolateMultiDotProjectExpression.
public void testShouldInterpolateMultiDotProjectExpression() throws ExpressionEvaluationException {
final Build build = new Build();
build.setFinalName("final-name");
final Model model = new Model();
model.setBuild(build);
configSourceStub.setMavenProject(new MavenProject(model));
setupInterpolation();
final Object result = new AssemblyExpressionEvaluator(configSourceStub).evaluate("assembly.${project.build.finalName}");
assertEquals("assembly.final-name", result);
}
use of org.apache.maven.model.Build in project maven-plugins by apache.
the class AssemblyFormatUtilsTest method verifyOutputDirUsingMainProject.
private void verifyOutputDirUsingMainProject(final String outDir, final String finalName, final String groupId, final String artifactId, final String version, final String projectFinalName, final Properties properties, final String checkValue) throws AssemblyFormattingException {
final MavenProject project = createProject(groupId, artifactId, version, properties);
if (projectFinalName != null) {
final Build build = new Build();
build.setFinalName(projectFinalName);
project.getModel().setBuild(build);
}
final MavenProject moduleProject = createProject("unknown", "unknown", "unknown", null);
final MavenProject artifactProject = createProject("unknown", "unknown", "unknown", null);
verifyOutputDir(outDir, finalName, project, moduleProject, artifactProject, checkValue);
}
use of org.apache.maven.model.Build in project maven-plugins by apache.
the class SiteStageDeployMojo method getStagingSiteURL.
/**
* Extract the value of the stagingSiteURL configuration parameter of
* maven-site-plugin for the given project.
*
* @param project The MavenProject, not null
* @return The stagingSiteURL for the project, or null if it doesn't have one
*/
private String getStagingSiteURL(MavenProject project) {
final String sitePluginKey = "org.apache.maven.plugins:maven-site-plugin";
if (project == null) {
return null;
}
final Build build = project.getBuild();
if (build == null) {
return null;
}
Map<String, Plugin> plugins = build.getPluginsAsMap();
Plugin sitePlugin = plugins.get(sitePluginKey);
if (sitePlugin == null) {
final PluginManagement buildPluginManagement = build.getPluginManagement();
if (buildPluginManagement == null) {
return null;
}
plugins = buildPluginManagement.getPluginsAsMap();
sitePlugin = plugins.get(sitePluginKey);
}
if (sitePlugin == null) {
return null;
}
final Xpp3Dom sitePluginConfiguration = (Xpp3Dom) sitePlugin.getConfiguration();
if (sitePluginConfiguration == null) {
return null;
}
final Xpp3Dom child = sitePluginConfiguration.getChild("stagingSiteURL");
if (child == null) {
return null;
} else {
return child.getValue();
}
}
use of org.apache.maven.model.Build in project maven-plugins by apache.
the class ModuleMavenProjectStub method getBuild.
/** {@inheritDoc} */
public Build getBuild() {
Build build = new Build();
build.setDirectory(PlexusTestCase.getBasedir() + "/target/test-harness/checkstyle/multi");
build.setSourceDirectory(PlexusTestCase.getBasedir() + "/src/test/test-sources");
build.setTestSourceDirectory(PlexusTestCase.getBasedir() + "/src/test/java");
return build;
}
Aggregations