From owner-freebsd-ports@freebsd.org Wed Jul 24 08:13:59 2019 Return-Path: Delivered-To: freebsd-ports@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F568A1C15 for ; Wed, 24 Jul 2019 08:13:59 +0000 (UTC) (envelope-from daniel@morante.net) Received: from venus.morante.net (venus.morante.net [63.247.147.163]) by mx1.freebsd.org (Postfix) with ESMTP id D1CCA6ED0D for ; Wed, 24 Jul 2019 08:13:55 +0000 (UTC) (envelope-from daniel@morante.net) Received: from saturn.morante.com (localhost [127.0.0.1]) by venus.morante.net (Postfix) with ESMTP id 72AA011F80C for ; Mon, 22 Jul 2019 11:47:36 -0400 (EDT) X-Virus-Scanned: amavisd-new at morante.net Received: from venus.morante.net ([127.0.0.1]) by saturn.morante.com (saturn.morante.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id goNDk_N5Mzid for ; Mon, 22 Jul 2019 11:47:36 -0400 (EDT) Received: from [192.168.0.2] (my-room.morante.com [192.168.0.2]) by venus.morante.net (Postfix) with ESMTPSA id C95F511F807 for ; Mon, 22 Jul 2019 11:47:35 -0400 (EDT) Subject: Re: How to package maven based ports To: freebsd-ports@freebsd.org References: <4C4DBC58-F44E-4435-BC92-37A19D555243@gmail.com> From: Daniel Morante Message-ID: Date: Mon, 22 Jul 2019 11:47:21 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <4C4DBC58-F44E-4435-BC92-37A19D555243@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: D1CCA6ED0D X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.75 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; TO_DN_NONE(0.00)[]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[morante.net:+]; RCVD_IN_DNSWL_MED(-0.20)[163.147.247.63.list.dnswl.org : 127.0.5.2]; DMARC_POLICY_ALLOW(-0.50)[morante.net,quarantine]; MX_GOOD(-0.01)[venus.morante.net]; NEURAL_HAM_SHORT(-0.15)[-0.152,0]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(-0.01)[country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; DATE_IN_PAST(1.00)[]; ASN(0.00)[asn:30221, ipnet:63.247.144.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.982,0]; R_DKIM_ALLOW(-0.20)[morante.net:s=default]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_MED(0.00)[morante.net.dwl.dnswl.org : 127.0.5.2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-ports@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; RBL_COMPOSITE_RCVD_IN_DNSWL_MED_DWL_DNSWL_MED(0.00)[] X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jul 2019 08:13:59 -0000 On 7/22/2019 8:08 AM, Jimmy Kelley wrote: > > Sent from my iPhone > >> On Jul 20, 2019, at 14:33, Daniel Morante wrote: >> >> I've run into the same issue while attempting to port a few JAVA apps that use maven and more recently one that also uses yarn for dependencies. >> >>> Have a look at the java/eclipse port. It uses a pre-warmed maven >>> repository that is fetched from github. >> While this is indeed a clever solution, it's (in my opinion) not ideal. Don't take this personally, I applaud you for taking the time and effort in making the Eclipse port. I use it on my systems. However, I feel that it's important that I point this out. There are potential problems with this approach. Most notably that the source of the dependencies gets changed from the original location. The consequences could be serious should something happen to your repository. >> >> This in my opinion is a bigger issue caused by these so called 'modern' package managers that are becoming popular to use (maven, npm, yarn, and composer to name a few). Historically like what is currently done with perl and python (and to a lesser extent ruby), we would create ports for each of these libraries and let the ports system handle the rest. >> >> Ideally the FreeBSD ports system should have the needed tooling to fetch these type of dependencies as part of the same process used during the dist files retrieval step. One method would be for the porter to include the pom.xml, composer.json, and/or package.json files as part of the port skeleton. The ports system would (using appropriate tools) download the dependencies to 'pre-warm' a local cache as you are doing. Then set the environment to use the local cache instead of downloading during the build phase. >> >> I think this may be possible to hack together using the current make targets 'pre-fetch' and 'post-fetch'? Further thinking about this, having the pom.xml in the skeleton may not even be needed is you can use the post-fetch target? >> >>> On 7/14/2019 3:21 PM, Matthias Fechner wrote: >>>> Am 14.07.2019 um 00:23 schrieb Jonathan Chen: >>>> Have a look at the java/eclipse port. It uses a pre-warmed maven >>>> repository that is fetched from github. >>>> >>>> You can create a localised repository that only contains the >>>> dependancies required by the project by specifying: >>>> -D maven.repo.local=/my/local/repo >>>> >>>> Once your project builds correctly, you can create a repo as a project >>>> on Github with its contents that can be retrieved with the port for >>>> the build. >>> thanks a lot for this. >>> I'm not fully done with the port, but I was able to get this maven >>> repository to be pushed to github and the port downloads it and >>> compilation works as expected. >>> Thanks a lot for you answer, it helped a lot. >>> >>> Now I need someone for testing the port, as I do not use it and are >>> therefor I'm not able to test it. >>> >>> The final step would be to do some clean up a make the port more pretty. >>> >>> I try later to write a short summary if some one else needs to build a >>> port with maven how it could be done. >>> >>> Gruß >>> Matthias >>> > While using a pre-warmed repository does change the source of the dependencies, one thing it protects you from is when a specific version of a needed dependency is suddenly removed from the source repo. I saw this happen too many times working the Eclipse port over the years (and thanks Jonathan for taking this over) - Eclipse would be released being built against a snapshot version of something and two weeks later an official release of that ‘something’ is pushed out and the snapshot repo is deleted. > > And while it way work for simple projects to be able to use the built-in maven capability to just resolve and download dependencies (and do nothing else) as a single command in the port fetching phases, this might not work for all projects - definitely not something as complex as a Eclipse. I wonder if maybe we could revive the `net-im/mastodon` port by using that same pre-warmed repository approach? > > Jimmy > _______________________________________________ > freebsd-ports@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-ports > To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org"