How to package maven based ports

Jason Helfman jgh at helfman.org
Tue Aug 6 17:55:56 UTC 2019


I've looked over this thread a bit, and have done similar things in the past. I have created an archive of a maven repository after having remote repos break the repeatable build process. I would create an archive, and then use this archive as a distfile. I would then point to this archive during the build phase to use as a repo.



I have also updated the using-java bits of the handbook awhile ago regarding installing war files.



databases/jasperreports (a port I used to maintain was setup this way)



Over the years, I have suggested this methodology, which folks agreed with at the time, and have been in some ports since. 


https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/using-java.html



Hope this helps

-jgh


---- On Sat, 20 Jul 2019 12:33:50 -0700 Daniel Morante via freebsd-ports <freebsd-ports at freebsd.org> 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
>
_______________________________________________
mailto:freebsd-ports at freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "mailto:freebsd-ports-unsubscribe at freebsd.org"


More information about the freebsd-ports mailing list