void () { assertEmpty(getArtifacts()); var artifact = addArtifact("MyArtifact", new ArtifactRootElementImpl()); ModifiableArtifactModel model = getArtifactManager().createModifiableModel(); ModifiableArtifact modifiableArtifact = model.getOrCreateModifiableArtifact(artifact); modifiableArtifact.getRootElement().getChildren(); // This is important to access prev root element modifiableArtifact.setRootElement(new ArtifactRootElementImpl()); var found = model.getArtifactsByType(PlainArtifactType.getInstance()).stream().findFirst().get(); CompositePackagingElement<?> root = found.getRootElement(); root.getChildren(); }