Ejemplo n.º 1
0
  public void execute() throws MojoExecutionException {

    AetherUtil.setRepositorySystemSession(repoSession);
    AetherUtil.setRepositorySystem(repoSystem);

    mergerComponent = new KevoreeMergerComponent();

    ContainerRoot model = KevoreeFactory.createContainerRoot();

    if (sourceMarShellDirectory != null) {
      ContainerRoot model2 = executeOnDirectory(sourceMarShellDirectory);
      mergerComponent.merge(model, model2);
    }

    if (sourceMarShellDirectory2 != null) {
      ContainerRoot model2 = executeOnDirectory(sourceMarShellDirectory2);
      mergerComponent.merge(model, model2);
    }

    if (!sourceOutputDirectory.exists() && !sourceOutputDirectory.mkdirs()) {
      throw new MojoExecutionException(
          "Unable to build target packages " + sourceOutputDirectory.getAbsolutePath());
    }

    KevoreeXmiHelper.save(
        sourceOutputDirectory.getAbsolutePath() + File.separator + "lib.kev", model);

    Resource resource = new Resource();
    resource.setTargetPath("KEV-INF");
    resource.setDirectory(sourceOutputDirectory.getAbsolutePath());

    project.addResource(resource);
  }
Ejemplo n.º 2
0
 private ContainerRoot executeOnDirectory(File dir) throws MojoExecutionException {
   ContainerRoot mergedModel = KevoreeFactory.createContainerRoot();
   if (dir.listFiles() != null) {
     for (File f : dir.listFiles()) {
       if (f.isDirectory()) {
         ContainerRoot model = executeOnDirectory(f);
         mergedModel = mergerComponent.merge(mergedModel, model);
       } else {
         //				try {
         ContainerRoot model = ModelGenerator.generate(f.getAbsolutePath(), project);
         mergedModel = mergerComponent.merge(mergedModel, model);
         /*} catch (Exception e) {
             getLog().error("Unable to parse the source file", e);
         }*/
       }
     }
   }
   return mergedModel;
 }