override protected def packageJar()

in packaging/src/main/scala/org/jetbrains/sbtidea/packaging/artifact/IdeaArtifactXmlBuilder.scala [36:53]


  override protected def packageJar(to: Path, mappings: Mappings): Unit = {
    assert(mappings.nonEmpty, s"Jar file should have at least one source defined: $to")

    val node = findOrCreateDirNode(mappings.head.entry)
    val nodes = mappings.map {
      case Mapping(_, _, MappingMetaData(_, _, _, Some(projectName), MAPPING_KIND.TARGET)) =>
        ModuleContent(projectName)
      case Mapping(from, _, MappingMetaData(_, _, _, _, MAPPING_KIND.LIB)) =>
        ExtractJar(from.toPath)
      case Mapping(from, _, MappingMetaData(_, _, _, _, MAPPING_KIND.LIB_ASSEMBLY)) =>
        ExtractJar(from.toPath)
      case other if other.from.isDirectory =>
        CopyDir(other.from.toPath)
      case other =>
        CopyFile(other.from.toPath)
    }.reverse   // JPS artifact builder only copies the first one from a list of equally named files
    node.children += PackageJar(nodes, to.getFileName.toString)
  }