Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jwtSB-0002HI-N0 for pljava-dev@arkaria.postgresql.org; Sat, 18 Jul 2020 20:29:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jwtSA-0000H3-GP for pljava-dev@arkaria.postgresql.org; Sat, 18 Jul 2020 20:29:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jwtSA-0000GZ-Bo for pljava-dev@lists.postgresql.org; Sat, 18 Jul 2020 20:29:02 +0000 Received: from anastigmatix.net ([68.171.219.55]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jwtS3-0006zR-N7 for pljava-dev@lists.postgresql.org; Sat, 18 Jul 2020 20:29:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=blEATIEB5phaws1Q08X5gHXYflPsC3MBVBzi9oc6M/A=; b=Stgd44Nq9z0yPhoVPo+FzDb+Hw 3Okk3sFbg9bhxdVgMMmdS2owws+W3Fht4l1YOOXEdKq4+/3UeWobEJxPEpKMm7jL4H5Efj7/x4Sf/ 6wqVynt5Sw10u0QwBVyKWqcCEBriXZx9meg1+Mc/DK1jMWg+dPYb9CxVzjR4+HcZhI8XOaWJNprUf OLKaEsBRoxVBFsyrKBO3ubUmzvKYD/tHd/+LjfsLSaoKJ1gf4AV78/TWBGQSUWu9hFS9jVrT75vKT EZtmUWJ5GrJGliYxaHV/1u6W3/aDwA4POF7JUW0Mzf830CK3XDJhxa6Zk16WQWLYWwCpHS9nlWhmq F4xhsJLg==; Received: from [184.19.31.139] (port=47417) by bay.acenet.us with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1jwtS1-00DpCo-3j; Sat, 18 Jul 2020 16:28:53 -0400 Subject: Re: PL/Java new build plugin To: Kartik Ohri References: <5F077926.2050806@anastigmatix.net> <5F07C2D5.5050904@anastigmatix.net> <5F0D35BA.30904@anastigmatix.net> <5F0E3972.5070609@anastigmatix.net> <5F0F2DA2.5090603@anastigmatix.net> <5F12FF49.6090906@anastigmatix.net> <5F12FF80.5020208@anastigmatix.net> <5F1338F8.6030506@anastigmatix.net> Cc: pljava-dev@lists.postgresql.org From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5F135B84.8070302@anastigmatix.net> Date: Sat, 18 Jul 2020 16:28:52 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-OutGoing-Spam-Status: No, score=-95.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 07/18/20 15:49, Kartik Ohri wrote: > inside out. maven.plugin.classpath is not something that maven declares. It > is declared by the maven antrun plugin for use by ant tasks [2] > . Aha! And it generates that using getPathFromArtifacts(), which just goes through its own dependency list and collects the jar names (which are maybe the exact same jar names its current ClassRealm loader is using). I wonder what would happen just making a dead-simple ClassLoader with two "parents" and otherwise no functionality of its own. Of course it could only have one real parent and an instance field for the 'extra' one. Create it so one 'parent' is the ClassRealm loader that loaded us, and the other is from getSystemClassLoader() (they changed the official name to "application class loader" but didn't rename the method). Have its findClass method just say "either parent A has it or parent B has it or I haven't heard of it, sorry." (In fact, findClass doesn't get called until the 'real' parent has already been checked, so it doesn't need to do anything besides check the 'extra' parent and return what it finds, if anything.) That would leave the question of which parent should be the real one and which should be the extra one, since the real one is the one that gets searched first. In Java tradition, the app loader would be the real one. For Maven it might be better to make the ClassRealm the real one, so everything Maven constructed gets used, except when it fails to find something. I think you can pass a chosen ClassLoader directly to the ScriptEngineManager constructor, so this special loader wouldn't need to be used anywhere but there. What Could Possibly Go Wrong?™ Regards, -Chap