This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 204898 - Support AbstractMavenLifecycleParticipant
Summary: Support AbstractMavenLifecycleParticipant
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Milos Kleint
URL: http://article.gmane.org/gmane.comp.j...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-09 16:04 UTC by Jesse Glick
Modified: 2017-02-13 21:10 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
exceptions thrown by project loading. (7.79 KB, text/plain)
2012-08-02 13:43 UTC, Milos Kleint
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2011-11-09 16:04:35 UTC
MNG-4224 in M3 introduced AbstractMavenLifecycleParticipant which can be used by build extensions to do various things including affecting the dependency list of a project. While this works for a command-line build via DefaultMaven.doExecute, it seems the IDE's embedder does not run these hooks.

Possibly useful for bug #192566.
Comment 1 Milos Kleint 2012-03-27 12:17:58 UTC
AFAIK not used by anything else currently other than tycho. IMHO not a defect but enhancement
Comment 2 Jesse Glick 2012-08-01 17:42:37 UTC
maven-tiles.zip in https://jira.codehaus.org/browse/MNG-5102 is an example of an interesting use of AMLP which would not be correctly loaded by the IDE today.
Comment 3 Milos Kleint 2012-08-01 17:52:49 UTC
I can only imagine this being optional, explicitly enabled by user.
we might have no idea whatsoever what being done while loading the project
Comment 4 Jesse Glick 2012-08-01 18:15:46 UTC
If the presence of an AMLP among the project's build extensions can be detected - which should be pretty straightforward based on scanning Plexus metadata - load the project without it but show a warning in the GUI. (Status line, and/or badge on project to be included by ProblemReporter.) User should have an easy way to reload the project with the AMLP active, and the option to subsequently "trust" that project, or any project using the same AMLP as identified by class name.

(Ideally could run in a sandbox, but that would require various Maven/Aether components such as the repository layer to use AccessController.doPrivileged consistently - so that an AMLP could do things like download a missing artifact to the local repo without having general filesystem write access - and this seems unlikely.)
Comment 5 Milos Kleint 2012-08-02 13:43:26 UTC
Created attachment 122686 [details]
exceptions thrown by project loading.

I've tried to do something along these lines as jesse describes. Detecting the participant is easy and working. Enabling it is a hard nut however.

I've tried with tycho, as that's the only commonly used build participant afaik.
It appears to be doing something, but doesn't reach far enough. Could be some sort of error on my side, messing with classloaders or maven sessions.

the core reason for the failure is in a sense funny:
java.lang.RuntimeException: java.lang.IllegalStateException: Nested Equinox instance is not supported.

And that's what I feared all along when enabling the build participants, one never knows what code they execute..
Comment 6 Milos Kleint 2012-08-03 06:43:26 UTC
http://hg.netbeans.org/core-main/rev/a46360e4889a

no execution of external code now happening, experiments with tycho proved it could be disasterous.
however at least show that the external participant is there and not executed. At least labels the tycho projects as being problematic
Comment 7 Jesse Glick 2012-08-03 11:51:44 UTC
Tycho is probably the pathological worst case; far simpler cases that would load easily might come along, but for now I guess it is rare enough to ignore.
Comment 8 Quality Engineering 2012-08-04 02:32:49 UTC
Integrated into 'main-golden', will be available in build *201208040001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/a46360e4889a
User: Milos Kleint <mkleint@netbeans.org>
Log: #204898 figure out if any external build participants are present and show that as a warning.
Comment 9 desmond_kirrane 2017-02-01 20:25:58 UTC
Any chance this could be re-opened. I am using a simple AbstractMavenLifecycleParticipant that sets the project version and certain dependency versions.

Or is there a way to enable it for a certain AMLP
Comment 10 desmond_kirrane 2017-02-13 21:10:36 UTC
https://netbeans.org/bugzilla/show_bug.cgi?id=269741