I don't think you can do it easily with the sbt-idea plugin. What you could do though is define your own command gen-idea-fx
, which would run the original gen-idea
and then generate the file you want.
build.sbt
val generateIdeaFx: State => State = { state =>
val newState = Command.process("gen-idea", state)
val extracted: Extracted = Project.extract(newState)
import extracted._
val projectName: String = (name in currentRef get structure.data).get
val artifactName: String = (artifact in (currentRef, Compile, packageBin) get structure.data).map { a =>
a.name + a.extension
}.get
val artifactXml =
<component name="ArtifactManager">
<artifact type="javafx" name={projectName}>
<output-path>$PROJECT_DIR$/target/idea_output/artifacts/{projectName}</output-path>
<element id="root">
<element id="archive" name={artifactName} />
</element>
</artifact>
</component>
val outputFile = (baseDirectory in currentRef get structure.data).get / ".idea" / "artifacts" / s"$projectName.xml"
IO.write(outputFile, artifactXml.mkString)
newState
}
val genIdeaFx = Command.command("gen-idea-fx")(generateIdeaFx)
commands += genIdeaFx
Now you can generate Idea project by calling gen-idea-fx
.