Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="https://github.com/evgeny-goldin/build-info/blob/3712d354f31d813c18c10a35dc07e9581979e61f/build.gradle#L360" rel="nofollow">Here's something</a> that worked for me:</p> <ul> <li>After compiling plugin's sources generate project's POM: <code>"install.repositories.mavenInstaller.pom.writeTo( 'pom.xml' )"</code></li> <li>Patch POM generated and provide plugin's coordinates and correct destination directories</li> <li>Run <code>"mvn org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor"</code></li> </ul> <p>This way <code>"build/classes/main/META-INF/maven/plugin.xml"</code> is created and then packed properly by <code>jar</code> task, which is all that's needed for a jar file to become a Maven plugin, AFAIK. Also, I believe, <a href="https://maven.apache.org/plugin-tools/maven-plugin-plugin/examples/using-annotations.html" rel="nofollow">"maven-plugin-annotations"</a> should be used in a plugin.</p> <pre><code>task pluginDescriptor( type: Exec ) { commandLine 'mvn', '-e', '-B', 'org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor' doFirst { final File pom = project.file( 'pom.xml' ) install.repositories.mavenInstaller.pom.writeTo( pom ) assert pom.file, "[$pom.canonicalPath] was not created" pom.text = pom.text. replace( '&lt;groupId&gt;unknown&lt;/groupId&gt;', "&lt;groupId&gt;${project.group}&lt;/groupId&gt;" ). replace( '&lt;artifactId&gt;empty-project&lt;/artifactId&gt;', "&lt;artifactId&gt;${project.name}&lt;/artifactId&gt;" ). replace( '&lt;version&gt;0&lt;/version&gt;', """ |&lt;version&gt;${version}&lt;/version&gt; | &lt;packaging&gt;maven-plugin&lt;/packaging&gt; | &lt;build&gt; | &lt;directory&gt;\${project.basedir}/build&lt;/directory&gt; | &lt;outputDirectory&gt;\${project.build.directory}/classes/main&lt;/outputDirectory&gt; | &lt;/build&gt; |""".stripMargin().trim()) } doLast { final pluginDescriptor = new File(( File ) project.compileGroovy.destinationDir, 'META-INF/maven/plugin.xml' ) assert pluginDescriptor.file, "[$pluginDescriptor.canonicalPath] was not created" println "Plugin descriptor file:$pluginDescriptor.canonicalPath is created successfully" } } project.compileGroovy.doLast{ pluginDescriptor.execute() } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload