Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

host Android build on maven central #166

Closed
CluEleSsUK opened this issue May 20, 2021 · 9 comments · Fixed by #230
Closed

host Android build on maven central #166

CluEleSsUK opened this issue May 20, 2021 · 9 comments · Fixed by #230
Labels
help wanted Extra attention is needed
Milestone

Comments

@CluEleSsUK
Copy link

CluEleSsUK commented May 20, 2021

Is your feature request related to a problem? Please describe.
Java 8/Android compatibility was added with #133, but presently I can't see the jar being hosted anywhere.

I was hoping to raise a PR on https://github.com/decentralized-identity/jsonld-common-java and https://github.com/decentralized-identity/did-common-java to provide Android support and titanium-json-ld is the key transitive dependency.

Describe the solution you'd like
titanium-json-ld uploaded under a separate artifactId to maven central or equivalent.

Describe alternatives you've considered
I've currently used git submodules to achieve the above, but it comes with problems:

  • gradle doesn't have a proxy for maven profiles, so building the maven module from gradle requires a fiddly bit of groovy
  • not sure if individual commits relate 1-1 to maven releases
  • it's ugly

I had a look in your github actions to try and raise a PR, but it didn't seem like the maven-push action actually does a maven push and I assumed you do it manually - I could well be misunderstanding though!

Additional context
Thanks for your work so far!

@filip26
Copy link
Owner

filip26 commented May 20, 2021

Hi @CluEleSsUK,
the current pom.xml uses profiles to separate Java11 and Android -Pandroid builds, the same applies on deployment -Pmaven-central. Unfortunately, this approach does not allow to build and deploy both artifacts together.

We need to rethink this and find out the right solution. As I'm not an expert on maven nor nexus-staging-maven-plugin a help is needed and very welcome.

@filip26 filip26 added the help wanted Extra attention is needed label May 20, 2021
@CluEleSsUK
Copy link
Author

I'm also no expert in maven or the nexus-staging plugin, but I'm happy to take a look. A cheap solution could be profiles for -Pmaven-central and -Pmaven-central-android - I'll see if I can come up with something tidier!

@filip26
Copy link
Owner

filip26 commented May 21, 2021

The tricky part is how to build all the artifact together.

e.g.

titanium-json-ld-1.0.3.jar
titanium-json-ld-1.0.3-android.jar
titanium-json-ld-1.0.3-javadoc.jar
titanium-json-ld-1.0.3-sources.jar
titanium-json-ld-1.0.3.pom

Some recommend https://maven.apache.org/plugins/maven-toolchains-plugin/ to get different builds done at once, to get rid off the android profile.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment!

@filip26
Copy link
Owner

filip26 commented Jun 13, 2022

The easiest solution is to name android artifact like titanium-json-ld-androd or titanium-android and publish it as a separate artifact, including separate versioning, javadoc, and sources.

@pkozelka
Copy link

Yes, separate module that gets always compiled. I believe it's best; conditional compilation is rarely a good thing in Java.

@filip26
Copy link
Owner

filip26 commented Jun 16, 2022

@pkozelka The biggest downside of this approach is that it requires two pom.xml - one for JRE11 build and second one for JRE8. Beside duplicates in the files there is no IDE support (e.g. now, you can select a maven profile in Eclipse).

What about Gradle? Could that help?

@filip26
Copy link
Owner

filip26 commented Jun 16, 2022

@filip26
Copy link
Owner

filip26 commented Jun 16, 2022

Structure:

pom_parent.xml
pom.xml <- default, inherits pom_parent.xml
pom_jre8.xml <- android build, inherits pom_parent.xml

Use maven-flatten-plugin to get distributable pom

> export JAVA_HOME=<JDK11>
> mvn clean package

> export JAVA_HOME=<JDK8>
> mvn -f pom_jre8.xml clean package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants