boolean standAlone = earEnvironment == null;
GerApplicationClientType gerAppClient = getGeronimoAppClient(plan, moduleFile, standAlone, targetPath, appClient, earEnvironment);
EnvironmentType clientEnvironmentType = gerAppClient.getClientEnvironment();
Environment clientEnvironment = EnvironmentBuilder.buildEnvironment(clientEnvironmentType, defaultClientEnvironment);
if(standAlone) {
String name = new File(moduleFile.getName()).getName();
idBuilder.resolve(clientEnvironment, name+"_"+name, "jar");
} else {
Artifact earConfigId = earEnvironment.getConfigId();
idBuilder.resolve(clientEnvironment, earConfigId.getArtifactId() + "_" + new File(moduleFile.getName()).getName(), "jar");
}
EnvironmentType serverEnvironmentType = gerAppClient.getServerEnvironment();
Environment serverEnvironment = EnvironmentBuilder.buildEnvironment(serverEnvironmentType, defaultServerEnvironment);
if (!standAlone) {
EnvironmentBuilder.mergeEnvironments(earEnvironment, serverEnvironment);
serverEnvironment = earEnvironment;
if(!serverEnvironment.getConfigId().isResolved()) {
throw new IllegalStateException("Server environment module ID should be fully resolved (not "+serverEnvironment.getConfigId()+")");
}
} else {
idBuilder.resolve(serverEnvironment, new File(moduleFile.getName()).getName(), "jar");
}