I want to add a new artifact to the module programatically when the module is created. I have to add libraries to the module settings, can I can add new artifcat settings so that a jar is generated and copied to a custom location. I have got the ModifiableArtifactModel through ArtifactManagerImpl
ArtifactManager artifactManager = ArtifactManagerImpl.getInstance(project);
ModifiableArtifactModel modifiableArtifactModel = artifactManager.createModifiableModel();
ArtifactRootElementImpl artifactRootElement = new ArtifactRootElementImpl();
//how to add current project's compilable units as a child to artifactRootElement??
modifiableArtifactModel.addArtifact("my artifact", new JarArtifactType(), artifactRootElement);
but I can't seem to figure out how to add the current project's compiled units to jar, set the output path.