From dev-return-126801-archive-asf-public=cust-asf.ponee.io@maven.apache.org Tue Oct 9 17:46:24 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4D52C180668 for ; Tue, 9 Oct 2018 17:46:24 +0200 (CEST) Received: (qmail 52469 invoked by uid 500); 9 Oct 2018 15:46:23 -0000 Mailing-List: contact dev-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Developers List" Reply-To: "Maven Developers List" Delivered-To: mailing list dev@maven.apache.org Received: (qmail 52458 invoked by uid 99); 9 Oct 2018 15:46:23 -0000 Received: from mail-relay.apache.org (HELO mailrelay2-lw-us.apache.org) (207.244.88.137) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2018 15:46:23 +0000 Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) by mailrelay2-lw-us.apache.org (ASF Mail Server at mailrelay2-lw-us.apache.org) with ESMTPSA id 65D6B469 for ; Tue, 9 Oct 2018 15:46:22 +0000 (UTC) Received: by mail-io1-f49.google.com with SMTP id l25-v6so1536655ioj.0 for ; Tue, 09 Oct 2018 08:46:22 -0700 (PDT) X-Gm-Message-State: ABuFfohZeo2d4IjD+sXx6bgeZ6r6pV18HNAOLTE7ksEdE0x6alGcBDkl jwErgm6vvawMqOg0fk1JdYUcLGLbnY38JWOQMtg= X-Google-Smtp-Source: ACcGV60RM4/0UyL4jZc5DTjJ7mlg6FRCK/3pRQBSdEpffkuHEC5kLEIklVyguj5wY5JjQ0t0VsDovx0XUcv3QbmoOeE= X-Received: by 2002:a6b:e515:: with SMTP id y21-v6mr18123182ioc.42.1539099981762; Tue, 09 Oct 2018 08:46:21 -0700 (PDT) MIME-Version: 1.0 From: Paul Benedict Date: Tue, 9 Oct 2018 10:45:45 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Problem sharing objects between extension and plugin To: ML-Apache-Maven-Developers Content-Type: multipart/alternative; boundary="000000000000afd9830577cda3ef" --000000000000afd9830577cda3ef Content-Type: text/plain; charset="UTF-8" Good day. I hope this post is acceptable. I don't mean to "cross post" but I think my problem may be too difficult for the common question on the user@ list. I scoured all the MNG tickets regarding extensions and class loading documentation on the Maven site (and elsewhere), but cannot find a clear answer to my problem. This problem is a roadblock for my work. I can't seem to make any headway; so any expedient response would be overwhelmingly appreciated. This may or may not be related to MNG-6209. TL;DR link to my user@ list post [1]. The quick summary: *) Project A (library of @Components and other utility classes) *) Project B (build plugin) *) Project C (uses build of Project A and build of Project B) The quick problem: In Project A, there is a lifecycle callback that takes an injected component from A, and stores it in the plugin context of B. When B retrieves the object, I receive a "type X cannot be case to type X" error. Is this intended? I am getting conflicted documentation. Curiously, the older documentation in SVN is much more descriptive. I wish this was the one on the site -- if it is still valid. Is it still valid information? Should this be really what the official mini guide should be? *) Published 2018-10-15: This is the #1 google hit for "maven class loader" search [1]. This is on the Maven site itself... There is no mention here a restriction on extensions and plugins unable to share classes. *) Published 2018-04-30: This is the #3 google hit for "maven class loader" search [1]. This is from SVN... There is mention here that "it is not possible" for extensions and plugins to share classes. Lastly, if the last documentation is the truth, is there any escape hatch? IMO, it is very valuable when a build extension is able to setup one-time data that plugins can later use. In my use case, I had to retrieve some complex information, which then allowed me to dynamically add a dependency to the build -- but I don't want to lose the ancillary information that went with the retrieval. I want that available to the plugin for further logic. Thoughts, please? References: [1] https://lists.apache.org/thread.html/341a92e7b9b4dab328077d32a8490df3bc9866c544bfcc03b5e4c6d9@%3Cusers.maven.apache.org%3E [2] https://maven.apache.org/guides/mini/guide-maven-classloading.html [3] https://svn.apache.org/repos/infra/websites/production/maven/content/reference/maven-classloading.html Cheers and God bless, Paul --000000000000afd9830577cda3ef--