}
@Override
public Resource<?> getFinalArtifact()
{
MavenFacetImpl mvn = (MavenFacetImpl) getFaceted().getFacet(MavenFacet.class);
try
{
Build build = mvn.getProjectBuildingResult().getProject().getBuild();
String directory = build.getDirectory();
String finalName = build.getFinalName();
if (Strings.isNullOrEmpty(directory))
{
throw new IllegalStateException("Project build directory is not configured");
}
if (Strings.isNullOrEmpty(finalName))
{
throw new IllegalStateException("Project final artifact name is not configured");
}
return factory.create(new File(directory.trim(), finalName + "."
+ getPackagingType().toLowerCase()));
}
catch (Exception e)
{
throw new RuntimeException("Could not resolve build directory for project ["
+ mvn.getModelResource().getFullyQualifiedName() + "]");
}
}