Skip to content

Commit

Permalink
Using parent's groupId when current is not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jul 2, 2014
1 parent 4994286 commit d88d25a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import javax.enterprise.context.Dependent;

import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.jboss.forge.addon.facets.AbstractFacet;
import org.jboss.forge.addon.facets.constraints.FacetConstraint;
import org.jboss.forge.addon.maven.projects.MavenFacet;
Expand Down Expand Up @@ -78,7 +79,13 @@ public String calculatePackage(final JavaResource resource)
@Override
public String getBasePackage()
{
return Packages.toValidPackageName(getFaceted().getFacet(MavenFacet.class).getModel().getGroupId());
Model model = getFaceted().getFacet(MavenFacet.class).getModel();
String groupId = model.getGroupId();
if (groupId == null)
{
groupId = model.getParent().getGroupId();
}
return Packages.toValidPackageName(groupId);
}

@Override
Expand Down

0 comments on commit d88d25a

Please sign in to comment.