protected File exportParametersToXml() throws Exception {
        PluginConfigXmlDocument configDocument = PluginConfigXmlDocument.newInstance("liberty-plugin-config");

        List<Profile> profiles = project.getActiveProfiles();
        configDocument.createActiveBuildProfilesElement("activeBuildProfiles", profiles);

        configDocument.createElement("installDirectory", installDirectory);
        configDocument.createElement("serverDirectory", serverDirectory);
        configDocument.createElement("userDirectory", userDirectory);
        configDocument.createElement("serverOutputDirectory", new File(outputDirectory, serverName));
        configDocument.createElement("serverName", serverName);
        configDocument.createElement("configDirectory", configDirectory);

        if (getFileFromConfigDirectory("server.xml", configFile) != null) {
            configDocument.createElement("configFile", getFileFromConfigDirectory("server.xml", configFile));
        }
        if (bootstrapProperties != null && getFileFromConfigDirectory("bootstrap.properties") == null) {
            configDocument.createElement("bootstrapProperties", bootstrapProperties);
        } else {
            configDocument.createElement("bootstrapPropertiesFile",
                    getFileFromConfigDirectory("bootstrap.properties", bootstrapPropertiesFile));
        }
        if (jvmOptions != null && getFileFromConfigDirectory("jvm.options") == null) {
            configDocument.createElement("jvmOptions", jvmOptions);
        } else {
            configDocument.createElement("jvmOptionsFile", getFileFromConfigDirectory("jvm.options", jvmOptionsFile));
        }
        if (getFileFromConfigDirectory("server.env", serverEnv) != null) {
            configDocument.createElement("serverEnv", getFileFromConfigDirectory("server.env", serverEnv));
        }

        configDocument.createElement("appsDirectory", getAppsDirectory());
        configDocument.createElement("looseApplication", looseApplication);
        configDocument.createElement("stripVersion", stripVersion);
        configDocument.createElement("installAppPackages", getInstallAppPackages());
        configDocument.createElement("applicationFilename", getApplicationFilename());
        configDocument.createElement("assemblyArtifact", assemblyArtifact);
        configDocument.createElement("assemblyArchive", assemblyArchive);
        configDocument.createElement("assemblyInstallDirectory", assemblyInstallDirectory);
        configDocument.createElement("refresh", refresh);
        configDocument.createElement("install", install);

        configDocument.createElement("installAppsConfigDropins",
                ApplicationXmlDocument.getApplicationXmlFile(serverDirectory));
        configDocument.createElement("projectType", project.getPackaging());
        if (project.getParent() != null && !project.getParent().getModules().isEmpty()) {
            configDocument.createElement("aggregatorParentId", project.getParent().getArtifactId());
            configDocument.createElement("aggregatorParentBasedir", project.getParent().getBasedir());
        }

        // returns all current project compile dependencies, including
        // transitive dependencies
        // if Mojo required dependencyScope is set to COMPILE
        Set<Artifact> artifacts = project.getArtifacts();
        for (Artifact artifact : artifacts) {
            if ("compile".equals(artifact.getScope()) || "runtime".equals(artifact.getScope())) {
                configDocument.createElement("projectCompileDependency",
                        artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion());
            }
        }

        // include warSourceDirectory for liberty-assembly project with source
        configDocument.createElement("warSourceDirectory", getLibertyAssemblyWarSourceDirectory(project));

        // write XML document to file
        File f = new File(project.getBuild().getDirectory() + File.separator + PLUGIN_CONFIG_XML);
        configDocument.writeXMLDocument(f);
        return f;
    }
protected File exportParametersToXml ( ) throws Exception { PluginConfigXmlDocument configDocument = PluginConfigXmlDocument . newInstance ( "liberty-plugin-config" ) ; List < Profile > profiles = project . getActiveProfiles ( ) ; configDocument . createActiveBuildProfilesElement ( "activeBuildProfiles" , profiles ) ; configDocument . createElement ( "installDirectory" , installDirectory ) ; configDocument . createElement ( "serverDirectory" , serverDirectory ) ; configDocument . createElement ( "userDirectory" , userDirectory ) ; configDocument . createElement ( "serverOutputDirectory" , new File ( outputDirectory , serverName ) ) ; configDocument . createElement ( "serverName" , serverName ) ; configDocument . createElement ( "configDirectory" , configDirectory ) ; if ( getFileFromConfigDirectory ( "server.xml" , configFile ) != null ) { configDocument . createElement ( "configFile" , getFileFromConfigDirectory ( "server.xml" , configFile ) ) ; } if ( bootstrapProperties != null && getFileFromConfigDirectory ( "bootstrap.properties" ) == null ) { configDocument . createElement ( "bootstrapProperties" , bootstrapProperties ) ; } else { configDocument . createElement ( "bootstrapPropertiesFile" , getFileFromConfigDirectory ( "bootstrap.properties" , bootstrapPropertiesFile ) ) ; } if ( jvmOptions != null && getFileFromConfigDirectory ( "jvm.options" ) == null ) { configDocument . createElement ( "jvmOptions" , jvmOptions ) ; } else { configDocument . createElement ( "jvmOptionsFile" , getFileFromConfigDirectory ( "jvm.options" , jvmOptionsFile ) ) ; } if ( getFileFromConfigDirectory ( "server.env" , serverEnv ) != null ) { configDocument . createElement ( "serverEnv" , getFileFromConfigDirectory ( "server.env" , serverEnv ) ) ; } configDocument . createElement ( "appsDirectory" , getAppsDirectory ( ) ) ; configDocument . createElement ( "looseApplication" , looseApplication ) ; configDocument . createElement ( "stripVersion" , stripVersion ) ; configDocument . createElement ( "installAppPackages" , getInstallAppPackages ( ) ) ; configDocument . createElement ( "applicationFilename" , getApplicationFilename ( ) ) ; configDocument . createElement ( "assemblyArtifact" , assemblyArtifact ) ; configDocument . createElement ( "assemblyArchive" , assemblyArchive ) ; configDocument . createElement ( "assemblyInstallDirectory" , assemblyInstallDirectory ) ; configDocument . createElement ( "refresh" , refresh ) ; configDocument . createElement ( "install" , install ) ; configDocument . createElement ( "installAppsConfigDropins" , ApplicationXmlDocument . getApplicationXmlFile ( serverDirectory ) ) ; configDocument . createElement ( "projectType" , project . getPackaging ( ) ) ; if ( project . getParent ( ) != null && ! project . getParent ( ) . getModules ( ) . isEmpty ( ) ) { configDocument . createElement ( "aggregatorParentId" , project . getParent ( ) . getArtifactId ( ) ) ; configDocument . createElement ( "aggregatorParentBasedir" , project . getParent ( ) . getBasedir ( ) ) ; } Set < Artifact > artifacts = project . getArtifacts ( ) ; for ( Artifact artifact : artifacts ) { if ( "compile" . equals ( artifact . getScope ( ) ) || "runtime" . equals ( artifact . getScope ( ) ) ) { configDocument . createElement ( "projectCompileDependency" , artifact . getGroupId ( ) + ":" + artifact . getArtifactId ( ) + ":" + artifact . getVersion ( ) ) ; } } configDocument . createElement ( "warSourceDirectory" , getLibertyAssemblyWarSourceDirectory ( project ) ) ; File f = new File ( project . getBuild ( ) . getDirectory ( ) + File . separator + PLUGIN_CONFIG_XML ) ; configDocument . writeXMLDocument ( f ) ; return f ; }
/*
Export plugin configuration parameters to
target/liberty-plugin-config.xml