From owner-freebsd-ports@freebsd.org Sat Jul 20 22:01:14 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 BD354A14D5 for ; Sat, 20 Jul 2019 22:01:14 +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 DB84C91544 for ; Sat, 20 Jul 2019 22:01:11 +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 1901C11F811 for ; Sat, 20 Jul 2019 15:34:03 -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 iK9AcU7hjjSE for ; Sat, 20 Jul 2019 15:34:02 -0400 (EDT) Received: from [192.168.0.2] (my-room.morante.com [192.168.0.2]) by venus.morante.net (Postfix) with ESMTPSA id 6A47111F807 for ; Sat, 20 Jul 2019 15:34:02 -0400 (EDT) Subject: Re: How to package maven based ports To: freebsd-ports@freebsd.org References: <9caa5ea5-e030-adab-516d-df957e07760f@fechner.net> From: Daniel Morante Message-ID: Date: Sat, 20 Jul 2019 15:33:50 -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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: DB84C91544 X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.36 / 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]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(-0.01)[country: US(-0.05)]; 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.99)[-0.993,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)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-ports@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_SPAM_SHORT(0.25)[0.253,0]; 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: Sat, 20 Jul 2019 22:01:14 -0000 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 >