Maven post jar for .ivy

I have a maven project that will create a jar file and I want to use it in another sbt project. Is there a way to publish a jar file in .ivy and not in .m2?

I am trying to put the jar file in libs in an sbt project, but it does not work. and using mvn install jar for .m2 does not work either.

+5
source share
1 answer

As I understand it, you have a maven project and an SBT project. The SBT project depends on the artifact created by your maven project.

You are asking how to publish the artifact created by maven to your local .ivy so that it can be picked up by the SBT project.

you can probably achieve this using the ant task in the maven assembly .

However, I would like to suggest different angles:

Make sbt project aware of local .m2

Just add resolvers += Resolver.mavenLocal to your sbt assembly definition, if you do not want to foul the definition of the main assembly, add this line to the local.sbt file along with the main assembly failure. SBT merges all .sbt files found in the project root.

Publish to a controlled repository

This is especially useful if you want the assembly to be easily reproducible outside your local machine. The idea is to simply publish the maven project on the actual server, whether it be an internal nexus server / artificial server for proprietary code or shared hosting of artifacts (e.g. bintray) I always use bintray to publish custom builds of open source projects, while I'm waiting for PR to be merged into master and will publish the official assembly.

Add your artifact server as a converter to the SBT project, and you're good to go :)

+5
source

Source: https://habr.com/ru/post/1236866/


All Articles