Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Autocompletion and nested configuration tags

Well, definitely you would have to load Mojo class in order to introspect it. Which means the ClassRealm for the plugin would have to be populated, which means all plugin dependencies need to be resolved and possibly downloaded. That could result in a quite a noticeable pause. On the other hand, the alternative for the user is googling up plugin's documentation or finding another POM where the plugin has been used, or determining the syntax through trial and error, which IMO will take much longer :) The information about configuration structure for a specific plugin artifact could be cached, both in memory and also in the local Maven repo (in case of SNAPSHOT artifacts a timestamp check would be necessary). This way the introspection / dependency resolution would have to be done once per plugin GAV. If you are concerned that users would still complain about the pause, an alert box could be displayed with the question "m2e can analyze plugin configuration to provide better completion suggestions, but it can take a few seconds, Yes, No, Don't ask me again"

Should I file an enhancement request? ;)

cheers,
Rafał


On 07/11/2011 06:04 PM, Igor Fedorenko wrote:
For this to work in "fully deterministic way", m2e would have to load
mojo instance, which I am not sure is feasible to implement in efficient
manner.

--
Regards,
Igor

On 11-07-11 6:34 PM, Rafał Krzewski wrote:
Right now m2e supports contextual completion of mojo parameter names. It
is very convenient.
Sometimes the parameters are not simple strings but are strongly typed.
Maven Mojo API has very definte semantics how Mojo parameters are
mapped  [1], [2], so this could be done in a fully deterministic way.

Consider this example:

<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>_

At this point the autocomlete should suggest "webResource" per
convention for multi valued parameters

<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<webResource>_

AbstractWarMojo.webResources is typed as array of Resource [3] so
org.apache.maven.plugins.model.Resource class is introspected to
determine what are possible further completions.

<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<webResource>
<directory>${project.basedir}/_

Resource.directory is typed as File [4] so the m2e can start suggesting
files and directories denoted by the pathname resulting from evaluation
of the expression between last > and cursor.
In case that File typed parameter does not evaluate to an existing
file/directory after the tag is closed, a warning marker could be set on
the POM file.

The top level parameter completion is very useful as it is, but I'd love
to see full completion in a future release of m2e

cheers,
Rafał

[1] http://maven.apache.org/developers/mojo-api-specification.html
[2]
http://maven.apache.org/guides/plugin/guide-java-plugin-development.html#Parameters
[3]
http://maven.apache.org/plugins/maven-war-plugin/xref/org/apache/maven/plugin/war/AbstractWarMojo.html#134
[4]
http://svn.apache.org/viewvc/maven/maven-3/tags/maven-3.0.3/maven-model/src/main/mdo/maven.mdo?revision=1075437&view=markup <http://svn.apache.org/viewvc/maven/maven-3/tags/maven-3.0.3/maven-model/src/main/mdo/maven.mdo?revision=1075437&view=markup%202166>
line 2166

W dniu 2011-07-11 16:08, Matthew Piggott pisze:
I may be mistaken, but I believe the elements inside configuration can
be plugin specific so it isn't practical to add contextual completion.

Matthew

On 10 July 2011 13:40, Sebastian Otaegui <feniix@xxxxxxxxx
<mailto:feniix@xxxxxxxxx>> wrote:

    Hello,

    When using autocompletion in a plugin after I enter the
<configuration></configuration> tag it seems the rest of the tag
    "do not have contextual completion".

    This is:

    I enter this config

    ...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
</archive>
</configuration>
</plugin>

    Inside <archive> it prompts me options to add (for example)
<finalName> which is not a valid tag inside <archive>

    Any plans to fix that behavior?

    Regards
    --
Those who do not understand Unix are condemned to reinvent it, poorly.
    Any sufficiently recent Microsoft OS contains an ad hoc,
informally-specified, bug-ridden, slow implementation of half of Unix.

    _______________________________________________
    m2e-users mailing list
    m2e-users@xxxxxxxxxxx <mailto:m2e-users@xxxxxxxxxxx>
    https://dev.eclipse.org/mailman/listinfo/m2e-users




_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users



_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users



Back to the top