0

I am trying to use Gradle to build my APIMan plugin, it builds a war and should process resources in src/main/apiman and include those resources in META-INF/apiman in the built war.

I'm having some trouble getting the build.gradle right. This is what I have

processResources {
  from("${project.rootDir}/src/main/apiman") {
    include('**/*.json')
  }
  filter ReplaceTokens, tokens: [
    "project.version": '1.5.2-SNAPSHOT',
    "project.groupId": 'io.apiman.plugins',
    "project.artifactId": 'apiman-plugins',
    "project.packaging": 'war' 
  ]
}

war {
  from("${project.rootDir}/src/main") {
      include('apiman')
      into('META-INF')
  }
}
PDStat
  • 5,513
  • 10
  • 51
  • 86

1 Answers1

1

For anyone interested, the following worked for me

war {
  with copySpec {
    from("src/main/apiman") {
      include('**/*')
      into('META-INF/apiman')
    }
    filter(ReplaceTokens, tokens: [
      "project.version": '1.5.2-SNAPSHOT',
      "project.groupId": 'io.apiman.plugins',
      "project.artifactId": 'apiman-plugins',
      "project.packaging": 'war' 
    ])
  }
}
PDStat
  • 5,513
  • 10
  • 51
  • 86
  • This is great, PDStat. Perhaps you can share your findings and process? Can you open a ticket on the apiman repository and we can discuss it? Perhaps we can update our guides to show how to make a Gradle version if Apiman plugins. Disclosure: I am an Apiman developer. – Marc Savy Feb 22 '21 at 20:29
  • Will have to look back and see if I can find it, wasn't much beyond this from what I remember. Did it as an integration for Okta, just a fork of the keycloak oauth plugin I believe – PDStat Feb 26 '21 at 17:55