コード例 #1
0
 /**
  * Create the fully qualified name of the model (using packaging type "pom").
  *
  * @param model The model.
  * @return The fully qualified name.
  */
 private String getFullyQualifiedName(Model model) {
   StringBuilder id = new StringBuilder();
   id.append((model.getGroupId() == null) ? "[inherited]" : model.getGroupId());
   id.append(":");
   id.append(model.getArtifactId());
   id.append(":pom:");
   id.append((model.getVersion() == null) ? "[inherited]" : model.getVersion());
   return id.toString();
 }
コード例 #2
0
 /**
  * Create the descriptor and set base information.
  *
  * @param model The model.
  * @param scanner The scanner.
  * @return The descriptor.
  */
 protected MavenPomDescriptor createMavenPomDescriptor(Model model, Scanner scanner) {
   ScannerContext context = scanner.getContext();
   MavenPomDescriptor pomDescriptor = context.peek(MavenPomDescriptor.class);
   pomDescriptor.setName(model.getName());
   pomDescriptor.setGroupId(model.getGroupId());
   pomDescriptor.setArtifactId(model.getArtifactId());
   pomDescriptor.setPackaging(model.getPackaging());
   pomDescriptor.setVersion(model.getVersion());
   String pomFqn = getFullyQualifiedName(model);
   pomDescriptor.setFullQualifiedName(pomFqn);
   Coordinates artifactCoordinates = new ModelCoordinates(model);
   MavenArtifactDescriptor artifact =
       getArtifactResolver(context).resolve(artifactCoordinates, context);
   // if the pom describes itself as artifact then the returned artifact
   // descriptor must be used as pom descriptor (the old instance is
   // invalidated due to adding labels)
   if (MavenPomDescriptor.class.isAssignableFrom(artifact.getClass())) {
     pomDescriptor = MavenPomDescriptor.class.cast(artifact);
   }
   pomDescriptor.getDescribes().add(artifact);
   return pomDescriptor;
 }