void mavenizeApp(ProjectModel projectModel)
    {
        LOG.info("Mavenizing ProjectModel " + projectModel.toPrettyString());
        MavenizationContext mavCtx = new MavenizationContext();
        mavCtx.graphContext = grCtx;

        WindupConfigurationModel config = grCtx.getUnique(WindupConfigurationModel.class);
        mavCtx.mavenizedBaseDir = config.getOutputPath().asFile().toPath().resolve(OUTPUT_SUBDIR_MAVENIZED);
        mavCtx.unifiedGroupId = new ModuleAnalysisHelper(grCtx).deriveGroupId(projectModel);
        mavCtx.unifiedAppName = normalizeDirName(projectModel.getName());
        mavCtx.unifiedVersion = "1.0";

        // 1) create the overall structure - a parent, and a BOM.

        // Root pom.xml ( serves as a parent pom.xml in our resulting structure).
        mavCtx.rootPom = new Pom(new MavenCoord(mavCtx.getUnifiedGroupId(), mavCtx.getUnifiedAppName() + "-parent", mavCtx.getUnifiedVersion()));
        mavCtx.rootPom.role = Pom.ModuleRole.PARENT;
        mavCtx.rootPom.name = projectModel.getName() + " - Parent";
        mavCtx.rootPom.description = "Parent of " + projectModel.getName();
        mavCtx.rootPom.root = true;
        final String bomArtifactId = mavCtx.getUnifiedAppName() + "-bom";

        // BOM
        Pom bom = new Pom(new MavenCoord(mavCtx.getUnifiedGroupId(), bomArtifactId, mavCtx.getUnifiedVersion()));
        bom.bom = getTargetTechnologies().contains("eap7")
                ? MavenizeRuleProvider.JBOSS_BOM_JAVAEE7_WITH_ALL
                : MavenizeRuleProvider.JBOSS_BOM_JAVAEE6_WITH_ALL;
        bom.role = Pom.ModuleRole.BOM;
        bom.parent = new Pom(MavenizeRuleProvider.JBOSS_PARENT);
        bom.description = "Bill of Materials. See https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html";
        bom.name = projectModel.getName() + " - BOM";
        mavCtx.getRootPom().submodules.put(bomArtifactId, bom);
        mavCtx.bom = bom;

        // BOM - dependencyManagement dependencies
        for( ArchiveCoordinateModel dep : grCtx.getUnique(GlobalBomModel.class).getDependencies() ){
            LOG.info("Adding dep to BOM: " + dep.toPrettyString());
            bom.dependencies.add(new SimpleDependency(Dependency.Role.LIBRARY, MavenCoord.from(dep)));
        }

        // 2) Recursively add the modules.
        mavCtx.rootAppPom = mavenizeModule(mavCtx, projectModel, null);

        // TODO: MIGR-236 Sort the modules.
        ///mavCtx.rootPom.submodules = sortSubmodulesToReflectDependencies(mavCtx.rootAppPom);

        // 3) Write the pom.xml's.
        new MavenStructureRenderer(mavCtx).createMavenProjectDirectoryTree();
    }
void mavenizeApp ( ProjectModel projectModel ) { LOG . info ( "Mavenizing ProjectModel " + projectModel . toPrettyString ( ) ) ; MavenizationContext mavCtx = new MavenizationContext ( ) ; mavCtx . graphContext = grCtx ; WindupConfigurationModel config = grCtx . getUnique ( WindupConfigurationModel . class ) ; mavCtx . mavenizedBaseDir = config . getOutputPath ( ) . asFile ( ) . toPath ( ) . resolve ( OUTPUT_SUBDIR_MAVENIZED ) ; mavCtx . unifiedGroupId = new ModuleAnalysisHelper ( grCtx ) . deriveGroupId ( projectModel ) ; mavCtx . unifiedAppName = normalizeDirName ( projectModel . getName ( ) ) ; mavCtx . unifiedVersion = "1.0" ; mavCtx . rootPom = new Pom ( new MavenCoord ( mavCtx . getUnifiedGroupId ( ) , mavCtx . getUnifiedAppName ( ) + "-parent" , mavCtx . getUnifiedVersion ( ) ) ) ; mavCtx . rootPom . role = Pom . ModuleRole . PARENT ; mavCtx . rootPom . name = projectModel . getName ( ) + " - Parent" ; mavCtx . rootPom . description = "Parent of " + projectModel . getName ( ) ; mavCtx . rootPom . root = true ; final String bomArtifactId = mavCtx . getUnifiedAppName ( ) + "-bom" ; Pom bom = new Pom ( new MavenCoord ( mavCtx . getUnifiedGroupId ( ) , bomArtifactId , mavCtx . getUnifiedVersion ( ) ) ) ; bom . bom = getTargetTechnologies ( ) . contains ( "eap7" ) ? MavenizeRuleProvider . JBOSS_BOM_JAVAEE7_WITH_ALL : MavenizeRuleProvider . JBOSS_BOM_JAVAEE6_WITH_ALL ; bom . role = Pom . ModuleRole . BOM ; bom . parent = new Pom ( MavenizeRuleProvider . JBOSS_PARENT ) ; bom . description = "Bill of Materials. See https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html" ; bom . name = projectModel . getName ( ) + " - BOM" ; mavCtx . getRootPom ( ) . submodules . put ( bomArtifactId , bom ) ; mavCtx . bom = bom ; for ( ArchiveCoordinateModel dep : grCtx . getUnique ( GlobalBomModel . class ) . getDependencies ( ) ) { LOG . info ( "Adding dep to BOM: " + dep . toPrettyString ( ) ) ; bom . dependencies . add ( new SimpleDependency ( Dependency . Role . LIBRARY , MavenCoord . from ( dep ) ) ) ; } mavCtx . rootAppPom = mavenizeModule ( mavCtx , projectModel , null ) ; new MavenStructureRenderer ( mavCtx ) . createMavenProjectDirectoryTree ( ) ; }
For the given application (Windup input), creates a stub of Mavenized project.
<p>
The resulting structure is: (+--- is "module", +~~~ is a dependency)
<pre>
Parent POM
+--- BOM
+~~~ JBoss EAP BOM
+--- JAR submodule
+~~~ library JARs
+--- WAR
+~~~ library JARs
+~~~ JAR submodule
+--- EAR
+~~~ library JAR
+~~~ JAR submodule
+~~~ WAR submodule
</pre>