Skip to content

Commit

Permalink
[MPLUGIN-495] WARNINGs based on usage of @component for MavenSession/…
Browse files Browse the repository at this point in the history
…MavenProject instead of @parameter

This closes #253
  • Loading branch information
michael-o committed Jan 6, 2024
1 parent 8b93d12 commit ac558bf
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 344 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,28 @@ assert mojo.configuration.touchFile[0].text() == '${first.touchFile}'
assert mojo.configuration.touchFile[0].'@implementation' == 'java.io.File'
assert mojo.configuration.touchFile[0].'@default-value' == '${project.build.directory}/touch.txt'

assert mojo.configuration.session[0].text() == ''
assert mojo.configuration.session[0].'@implementation' == 'org.apache.maven.execution.MavenSession'
assert mojo.configuration.session[0].'@default-value' == '${session}'
assert mojo.requirements.requirement.size() == 6

assert mojo.configuration.project[0].text() == ''
assert mojo.configuration.project[0].'@implementation' == 'org.apache.maven.project.MavenProject'
assert mojo.configuration.project[0].'@default-value' == '${project}'
assert mojo.requirements.requirement[0].role.text() == 'org.apache.maven.plugin.MojoExecution'
assert mojo.requirements.requirement[0].'field-name'.text() == 'mojo'

assert mojo.configuration.mojo[0].text() == ''
assert mojo.configuration.mojo[0].'@implementation' == 'org.apache.maven.plugin.MojoExecution'
assert mojo.configuration.mojo[0].'@default-value' == '${mojoExecution}'
assert mojo.requirements.requirement[1].role.text() == 'org.apache.maven.plugin.descriptor.PluginDescriptor'
assert mojo.requirements.requirement[1].'field-name'.text() == 'plugin'

assert mojo.configuration.plugin[0].text() == ''
assert mojo.configuration.plugin[0].'@implementation' == 'org.apache.maven.plugin.descriptor.PluginDescriptor'
assert mojo.configuration.plugin[0].'@default-value' == '${plugin}'
assert mojo.requirements.requirement[2].role.text() == 'org.apache.maven.project.MavenProject'
assert mojo.requirements.requirement[2].'field-name'.text() == 'project'

assert mojo.configuration.settings[0].text() == ''
assert mojo.configuration.settings[0].'@implementation' == 'org.apache.maven.settings.Settings'
assert mojo.configuration.settings[0].'@default-value' == '${settings}'
assert mojo.requirements.requirement[3].role.text() == 'org.apache.maven.project.MavenProjectHelper'
assert mojo.requirements.requirement[3].'role-hint'.text() == 'test'
assert mojo.requirements.requirement[3].'field-name'.text() == 'projectHelper'

assert mojo.requirements.requirement.size() == 1
assert mojo.requirements.requirement[4].role.text() == 'org.apache.maven.execution.MavenSession'
assert mojo.requirements.requirement[4].'field-name'.text() == 'session'

assert mojo.requirements.requirement[0].role.text() == 'org.apache.maven.project.MavenProjectHelper'
assert mojo.requirements.requirement[0].'role-hint'.text() == 'test'
assert mojo.requirements.requirement[0].'field-name'.text() == 'projectHelper'
assert mojo.requirements.requirement[5].role.text() == 'org.apache.maven.settings.Settings'
assert mojo.requirements.requirement[5].'field-name'.text() == 'settings'

assert mojo.parameters.parameter.size() == 8
assert mojo.parameters.parameter.size() == 3

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "namedParam" }[0]
assert parameter.name.text() == 'namedParam'
Expand All @@ -99,51 +94,6 @@ assert parameter.required.text() == 'false'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == 'Project directory.'

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "mojo" }[0]
assert parameter.name.text() == 'mojo'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.plugin.MojoExecution'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "plugin" }[0]
assert parameter.name.text() == 'plugin'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.plugin.descriptor.PluginDescriptor'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "project" }[0]
assert parameter.name.text() == 'project'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.project.MavenProject'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "session" }[0]
assert parameter.name.text() == 'session'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.execution.MavenSession'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "settings" }[0]
assert parameter.name.text() == 'settings'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.settings.Settings'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "touchFile" }[0]
assert parameter.name.text() == 'touchFile'
assert parameter.alias.isEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,28 @@ assert mojo.configuration.touchFile[0].text() == '${first.touchFile}'
assert mojo.configuration.touchFile[0].'@implementation' == 'java.io.File'
assert mojo.configuration.touchFile[0].'@default-value' == '${project.build.directory}/touch.txt'

assert mojo.configuration.session[0].text() == ''
assert mojo.configuration.session[0].'@implementation' == 'org.apache.maven.execution.MavenSession'
assert mojo.configuration.session[0].'@default-value' == '${session}'
assert mojo.requirements.requirement.size() == 6

assert mojo.configuration.project[0].text() == ''
assert mojo.configuration.project[0].'@implementation' == 'org.apache.maven.project.MavenProject'
assert mojo.configuration.project[0].'@default-value' == '${project}'
assert mojo.requirements.requirement[0].role.text() == 'org.apache.maven.plugin.MojoExecution'
assert mojo.requirements.requirement[0].'field-name'.text() == 'mojo'

assert mojo.configuration.mojo[0].text() == ''
assert mojo.configuration.mojo[0].'@implementation' == 'org.apache.maven.plugin.MojoExecution'
assert mojo.configuration.mojo[0].'@default-value' == '${mojoExecution}'
assert mojo.requirements.requirement[1].role.text() == 'org.apache.maven.plugin.descriptor.PluginDescriptor'
assert mojo.requirements.requirement[1].'field-name'.text() == 'plugin'

assert mojo.configuration.plugin[0].text() == ''
assert mojo.configuration.plugin[0].'@implementation' == 'org.apache.maven.plugin.descriptor.PluginDescriptor'
assert mojo.configuration.plugin[0].'@default-value' == '${plugin}'
assert mojo.requirements.requirement[2].role.text() == 'org.apache.maven.project.MavenProject'
assert mojo.requirements.requirement[2].'field-name'.text() == 'project'

assert mojo.configuration.settings[0].text() == ''
assert mojo.configuration.settings[0].'@implementation' == 'org.apache.maven.settings.Settings'
assert mojo.configuration.settings[0].'@default-value' == '${settings}'
assert mojo.requirements.requirement[3].role.text() == 'org.apache.maven.project.MavenProjectHelper'
assert mojo.requirements.requirement[3].'role-hint'.text() == 'test'
assert mojo.requirements.requirement[3].'field-name'.text() == 'projectHelper'

assert mojo.requirements.requirement.size() == 1
assert mojo.requirements.requirement[4].role.text() == 'org.apache.maven.execution.MavenSession'
assert mojo.requirements.requirement[4].'field-name'.text() == 'session'

assert mojo.requirements.requirement[0].role.text() == 'org.apache.maven.project.MavenProjectHelper'
assert mojo.requirements.requirement[0].'role-hint'.text() == 'test'
assert mojo.requirements.requirement[0].'field-name'.text() == 'projectHelper'
assert mojo.requirements.requirement[5].role.text() == 'org.apache.maven.settings.Settings'
assert mojo.requirements.requirement[5].'field-name'.text() == 'settings'

assert mojo.parameters.parameter.size() == 8
assert mojo.parameters.parameter.size() == 3

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "namedParam" }[0]
assert parameter.name.text() == 'namedParam'
Expand All @@ -99,51 +94,6 @@ assert parameter.required.text() == 'false'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == 'Project directory.'

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "mojo" }[0]
assert parameter.name.text() == 'mojo'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.plugin.MojoExecution'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "plugin" }[0]
assert parameter.name.text() == 'plugin'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.plugin.descriptor.PluginDescriptor'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "project" }[0]
assert parameter.name.text() == 'project'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.project.MavenProject'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "session" }[0]
assert parameter.name.text() == 'session'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.execution.MavenSession'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "settings" }[0]
assert parameter.name.text() == 'settings'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.settings.Settings'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "touchFile" }[0]
assert parameter.name.text() == 'touchFile'
assert parameter.alias.isEmpty()
Expand Down
80 changes: 15 additions & 65 deletions maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -56,33 +56,28 @@ assert mojo.configuration.touchFile[0].text() == '${first.touchFile}'
assert mojo.configuration.touchFile[0].'@implementation' == 'java.io.File'
assert mojo.configuration.touchFile[0].'@default-value' == '${project.build.directory}/touch.txt'

assert mojo.configuration.session[0].text() == ''
assert mojo.configuration.session[0].'@implementation' == 'org.apache.maven.execution.MavenSession'
assert mojo.configuration.session[0].'@default-value' == '${session}'
assert mojo.requirements.requirement.size() == 6

assert mojo.configuration.project[0].text() == ''
assert mojo.configuration.project[0].'@implementation' == 'org.apache.maven.project.MavenProject'
assert mojo.configuration.project[0].'@default-value' == '${project}'
assert mojo.requirements.requirement[0].role.text() == 'org.apache.maven.plugin.MojoExecution'
assert mojo.requirements.requirement[0].'field-name'.text() == 'mojo'

assert mojo.configuration.mojo[0].text() == ''
assert mojo.configuration.mojo[0].'@implementation' == 'org.apache.maven.plugin.MojoExecution'
assert mojo.configuration.mojo[0].'@default-value' == '${mojoExecution}'
assert mojo.requirements.requirement[1].role.text() == 'org.apache.maven.plugin.descriptor.PluginDescriptor'
assert mojo.requirements.requirement[1].'field-name'.text() == 'plugin'

assert mojo.configuration.plugin[0].text() == ''
assert mojo.configuration.plugin[0].'@implementation' == 'org.apache.maven.plugin.descriptor.PluginDescriptor'
assert mojo.configuration.plugin[0].'@default-value' == '${plugin}'
assert mojo.requirements.requirement[2].role.text() == 'org.apache.maven.project.MavenProject'
assert mojo.requirements.requirement[2].'field-name'.text() == 'project'

assert mojo.configuration.settings[0].text() == ''
assert mojo.configuration.settings[0].'@implementation' == 'org.apache.maven.settings.Settings'
assert mojo.configuration.settings[0].'@default-value' == '${settings}'
assert mojo.requirements.requirement[3].role.text() == 'org.apache.maven.project.MavenProjectHelper'
assert mojo.requirements.requirement[3].'role-hint'.text() == 'test'
assert mojo.requirements.requirement[3].'field-name'.text() == 'projectHelper'

assert mojo.requirements.requirement.size() == 1
assert mojo.requirements.requirement[4].role.text() == 'org.apache.maven.execution.MavenSession'
assert mojo.requirements.requirement[4].'field-name'.text() == 'session'

assert mojo.requirements.requirement[0].role.text() == 'org.apache.maven.project.MavenProjectHelper'
assert mojo.requirements.requirement[0].'role-hint'.text() == 'test'
assert mojo.requirements.requirement[0].'field-name'.text() == 'projectHelper'
assert mojo.requirements.requirement[5].role.text() == 'org.apache.maven.settings.Settings'
assert mojo.requirements.requirement[5].'field-name'.text() == 'settings'

assert mojo.parameters.parameter.size() == 8
assert mojo.parameters.parameter.size() == 3

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "namedParam" }[0]
assert parameter.name.text() == 'namedParam'
Expand All @@ -102,51 +97,6 @@ assert parameter.required.text() == 'false'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == 'Project directory.'

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "mojo" }[0]
assert parameter.name.text() == 'mojo'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.plugin.MojoExecution'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "plugin" }[0]
assert parameter.name.text() == 'plugin'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.plugin.descriptor.PluginDescriptor'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "project" }[0]
assert parameter.name.text() == 'project'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.project.MavenProject'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "session" }[0]
assert parameter.name.text() == 'session'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.execution.MavenSession'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "settings" }[0]
assert parameter.name.text() == 'settings'
assert parameter.alias.isEmpty()
assert parameter.type.text() == 'org.apache.maven.settings.Settings'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == ''

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "touchFile" }[0]
assert parameter.name.text() == 'touchFile'
assert parameter.alias.isEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ assert descriptorFile.isFile()
def pluginDescriptor = new XmlParser().parse( descriptorFile );

assert pluginDescriptor.mojos.mojo.size() == 1
assert pluginDescriptor.mojos.mojo.parameters.parameter.size() == 50
assert pluginDescriptor.mojos.mojo.parameters.parameter.size() == 48

return true;
Loading

0 comments on commit ac558bf

Please sign in to comment.