You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mike Samuel <mi...@gmail.com> on 2016/02/06 04:56:23 UTC

Maven Plugin that I can adapt for my own needs

I'm developing a maven plugin and I've worked through "Maven - Guide
to Developing Java Plugins" but am still having some trouble getting
configurations parsed consistently between MojoTestCases run under
eclipse and maven run at the command line.

Is there a maven plugin that is
1. a good example of proper maven3 plugin style,
2. which uses recent versions of the various org.apache.maven:* dependencies,
3. has some maven verifier testcases,
4. which I might adapt to suit my needs instead of trying to work from
a blank slate.

The plugin I'm writing runs during the verify lifecycle phase, gets
all "jar" dependencies transitively, and does some bytecode analysis
using ASM.
I tried to adapt the dependency:tree mojo but that is in the old style.

I'm also possibly doing something a little odd with configuration
processing - http://stackoverflow.com/questions/35235376 .

cheers,
mike

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven Plugin that I can adapt for my own needs

Posted by Mike Samuel <mi...@gmail.com>.
On Fri, Feb 5, 2016 at 10:56 PM, Mike Samuel <mi...@gmail.com> wrote:
> I'm developing a maven plugin and I've worked through "Maven - Guide
> to Developing Java Plugins" but am still having some trouble getting
> configurations parsed consistently between MojoTestCases run under
> eclipse and maven run at the command line.
>
> Is there a maven plugin that is
> 1. a good example of proper maven3 plugin style,
> 2. which uses recent versions of the various org.apache.maven:* dependencies,
> 3. has some maven verifier testcases,
> 4. which I might adapt to suit my needs instead of trying to work from
> a blank slate.
>
> The plugin I'm writing runs during the verify lifecycle phase, gets
> all "jar" dependencies transitively, and does some bytecode analysis
> using ASM.
> I tried to adapt the dependency:tree mojo but that is in the old style.
>
> I'm also possibly doing something a little odd with configuration
> processing - http://stackoverflow.com/questions/35235376 .
>
> cheers,
> mike


The bash script below let me extract the signals I need.  The
maven-eclipse-plugin looks the most promising, and the
maven-remote-resources-plugin and maven-repository-plugin work should
I find I need something that works under maven2.







#!/bin/bash

git clone https://github.com/apache/maven-plugins.git maven-plugins


function countAll() {
  find . -type f -print0 | xargs -0 egrep "$1" | wc -l
}

cd maven-plugins
for plugin in *-plugin; do
  pushd $plugin >& /dev/null

  echo "$plugin"
  echo "$(echo "$plugin" | perl -pe 's/./=/g')"
  echo "Uses annotations: $(countAll
'org[.]apache[.]maven[.]plugins[.]annotations[.]Mojo')"
  echo "Uses MojoTest: $(countAll 'AbstractMojoTestCase')"
  echo "Uses integration test: $(countAll
'org[.]apache[.]maven[.]it[.]Verifier')"
  echo "Maven-plugin-plugin version: $(cat pom.xml | perl -e '
      use strict;  use XML::XPath;
      my $root = XML::XPath->new(ioref => "STDIN");
      foreach my $node (
          $root->find(
              q{//plugin[artifactId = "maven-plugin-plugin"]/version/text()}
          )->get_nodelist) {
        print ("\t", $node->getData, "\n");
      }
      foreach my $node (
          $root->find(
              q{//mavenPluginToolsVersion/text()}
          )->get_nodelist) {
        print ("\t", $node->getData, "\n");
      }')"
  echo

  popd >& /dev/null
done

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org