kordamp / markdown-gradle-plugin

Markdown/HTML plugin for gradle
Apache License 2.0
71 stars 51 forks source link

Problems building locally #9

Closed emacdona closed 9 years ago

emacdona commented 9 years ago

I cloned this repo and attempted to build locally (wanted to see if this issue had been resolved: https://github.com/aalmiray/markdown-gradle-plugin/issues/7 -- please add that feature, btw ;-) ).

I had two problems: 1) The pom generation in gradle/publish.gradle was creating a bad pom. For some reason, the nested "license" element under "licenses" was being ignored, but its children weren't (I can't explain it) I was ending up with a pom that looked like this when attempting to publish to my local maven repo: <licenses> <name>The Apache Software License, Version 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.txt&lt;/url&gt; <distribution>repo</distribution> </licenses> 2) There was no "org.kordamp.gradle.markdown.properties" file in the META-INF/gradle-plugins directory of the jar. So once I got past the first problem, I kept getting errors telling me that there was no plugin with such and such id.

Here's a patch with my changes if it helps. The fix to (1) is an ugly hack. If you can't repro locally but are still curious -- please feel free to ask me questions like "What version of <x> are you using".

  From d7f3cc49a2bb3577a989425b60bf993fa2898fe8 Mon Sep 17 00:00:00 2001
  From: Ed MacDonald <emacdonald@arin.net>
  Date: Tue, 7 Oct 2014 00:23:24 -0400
  Subject: [PATCH] Had to add empty attributes to license xml element or it
   would NOT be included (no idea why). Added property file so that this plugin
   could have an id.

  ---
   gradle/publish.gradle                                                 | 4 ++--
   .../META-INF/gradle-plugins/org.kordamp.gradle.markdown.properties    | 1 +
   2 files changed, 3 insertions(+), 2 deletions(-)
   create mode 100644 src/main/resources/META-INF/gradle-plugins/org.kordamp.gradle.markdown.properties

  diff --git a/gradle/publish.gradle b/gradle/publish.gradle
  index dc3494a..08ed76b 100644
  --- a/gradle/publish.gradle
  +++ b/gradle/publish.gradle
  @@ -48,7 +48,7 @@ def pomConfig = {
       url 'https://github.com/aalmiray/markdown-gradle-plugin'
       inceptionYear '2013'
       licenses {
  -        license {
  +        license("") {
               name 'The Apache Software License, Version 2.0'
               url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
               distribution 'repo'
  @@ -103,4 +103,4 @@ bintray {
           licenses = ['Apache-2.0']
           labels = ['gradle', 'plugin', 'markdown']
       }
  -}
  \ No newline at end of file
  +}
  diff --git a/src/main/resources/META-INF/gradle-plugins/org.kordamp.gradle.markdown.properties b/src/main/resources/META-INF/gradle-plugins/org.kordamp.gradle.markdown.properties
  new file mode 100644
  index 0000000..9ff59db
  --- /dev/null
  +++ b/src/main/resources/META-INF/gradle-plugins/org.kordamp.gradle.markdown.properties
  @@ -0,0 +1 @@
  +implementation-class=org.kordamp.gradle.markdown.MarkdownPlugin
  --
  1.9.3 (Apple Git-50)
emacdona commented 9 years ago

I submitted a pull request to address the "org.kordamp.gradle.markdown.properties" problem. The same pull request initially addressed the license generation in the pom too, however I backed that change out because there is an existing pull request that addresses the problem.

aalmiray commented 9 years ago

Fixed by #10 and #15