Publish dbfit jars to Maven Central#384
Conversation
920d451 to
31175ef
Compare
|
@benilovj , @javornikolov - I've tidied up the commits on this one now. Any views on this PR yet? |
|
I wonder if we can have some of the changes not related to maven central publishing as separate PR (dependencies configuration refactoring, etc.) |
There was a problem hiding this comment.
Sometimes (almost always) we're using an intermediate fitnesse build (not the official one published to maven). Would it be still possible to do that with the updated notation?
There was a problem hiding this comment.
I think we can pull dev snapshots from the central repo as I've seen them on the Sonatype staging repo.
There was a problem hiding this comment.
BTW why do we use intermediate/snapshot versions of FitNesse? Can we use release versions instead?
There was a problem hiding this comment.
Regarding FitNesse dev snapshots - if we want to pin our dependencies to a specific FitNesse dev snapshot then I'm not sure that this is supported. I'd have to play with it. A release version would be better if possible.
There was a problem hiding this comment.
Intermediate versions might be useful e.g. to pick some fixes. But maybe the release versions are usually good enough.
There was a problem hiding this comment.
I wonder if we can have some of the changes not related to maven central publishing as separate PR (dependencies configuration refactoring, etc.)
Certainly. I'm not sure what's not directly related to publishing though. Any ideas welcomed.
|
Another point of discussion needs to be that more recent FitLibrary versions haven't been published (to Sonatype) as far as I can see. Therefore our dependencies can't be resolved only from public repositories which breaks the model. One option would be to publish FitLibrary (the version we're using) under the |
|
Summary of the outstanding discussion points so far: -
|
|
My view on where we are with each of the above: -
I think all of the changes directly related to publishing the JARs.
I think that we think that this is OK.
I think a sample file would be OK.
Your opinions required please.
Your opinions required please.
If we don't fork and publish then a fat JAR is the only option really. Are there any issues with that relating to breaking people's class paths by introducing additional and potentially conflicting JAR versions? |
Yes, let's include one but with with a different name. (We can rebase onto master first - it already has
I think we can try removing them for now. There is a list to github anyway.
Seems OK at the moment.
Whatever would work best now. I think it's OK to fork if needed to get approval for publishing the required fitlibrary version to a public repo.
Let's try to get a The rest looks fine to me. |
|
Great. For:
FitLibrary seems to have been abandoned. Very surprising seeing as how prominent it was it the FitNesse world. I tried contacting Darren a while ago but no response. I don't think we're likely to hear from him or Rick but I could try him too. For a thin JAR we'll need all dependencies resolvable from public artefact repos. FitLibrary used to be published under the fitnesse groupId up until 20080822. Should I persevere with Rick and Darren or fork FitLibrary 20091020 from SourceFirge under the DbFit GitHub organisation? |
|
Interestingly v1 seems to also have been published: |
I guess we can do both. If we get support for publishing under the original domain - we can switch to it (and abandon our fork). |
|
A query for a potential later PR.... So, we'll publish the DbFit executables as a single JAR. In that case what value is there in maintaining the current gradle project structure and build targets? |
Hmm. Should it be single JAR or we could keep them separate? |
I'm not sure of the benefits of the existing model. More JARs = more hassle, or just smaller footprint? Would anyone ever mix versions of DbFit JARs? |
|
I can imagine: smaller footprint, ability to swap just a part with customized/different version, multiple files can be copied in parallel. I don't say multiple jars is necessarily better, I'm not sure (up to know it hasn't been a huge problem). I got wondering about the possible use cases/benefits of having dbfit on maven central? Do we need to take care about the binary utility scripts? |
|
My main reason for working on this issue was so that I could create a PR against the FitNesse project to help detect breaking changes like the ill-fated PR 281. Im not sure why the DbFit 2.0 build switched to having multiple JARs. Maybe driven by the introduction of Maven but guessing really. The published 1.1 versions were a single JAR. Do you the encryption utils? Could we bundle them as resources in the JAR? Not perfect. |
31175ef to
8c7192d
Compare
|
Some updates applied: -
|
|
I've also updated the version number for DbFit in the parent |
|
There have been some user requests too: |
|
Also now renamed the skeleton gradle properties file. |
|
Cool!
I think that's just the default and simplest in case of multiple sub-projects, also seems better in terms of modularity. But it should be OK to have a single jar for Maven Central (as is) if that makes things simpler.
Just the Java classes (as is) looks to be enough to me for now. We're publishing dbfit as a library. |
|
Great! I think I've no more updates to make then unless you spot anything else. You can use it to publish 3.2.0 when you release it. |
dbfit-java/build.gradle
Outdated
There was a problem hiding this comment.
What is the default artifact and why do we want to remove it?
There was a problem hiding this comment.
The default artefact (artifact) for this project is dbfit-java-X.Y.Z.jar which has no class files in it as there are no Java source files in this project.
The artefact would get signed and published, by default, along with the additional aggregate JARs we create. I can enhance the comments if needed.
There was a problem hiding this comment.
I wonder if we could identify the default artifact in a bit more straightforward way (now we rely it's at the end of the list, has 'jar' in the name, etc.). I don't know if it's possible.
Or if using the same logic - maybe can be implemented a bit shorter, e.g. something like:
remove(configurations.archives.artifacts.archives.reverse().find { it.getType() == 'jar' })There was a problem hiding this comment.
now we rely it's at the end of the list
We could simply remove every artifact:
configurations.archives.artifacts.with { archives ->
archives.each {
remove(it)
}
}Do we need to even check the file type/name at all?
If we don't mind relying on the configuration only ever having one default artefact then yes let's condense to a one-liner.
In your snippet, how does the reverse.find work? What does it do?
There was a problem hiding this comment.
Ok, so reverse() is just to get at the last element in the List and find() finds the first matching element (in just that last element). So both of these mean that this will work only if the last default artefact is a JAR (which it would be for our specific case).
Or shall we just remove all of the default artefacts?
There was a problem hiding this comment.
After some digging into forums (perhaps I should read the docs at some point :-)):
- Looks like removing all defaults artifacts would give the same result right now:
configurations.archives.artifacts.clear() - If a need emerges to have non-JAR which we need to keep:
configurations.archives.artifacts.removeAll { it.archiveTask.is jar }
There was a problem hiding this comment.
perhaps I should read the docs at some point :-)):
Me too. There does seem to be endless ways in which to do any one thing in Gradle. Very flexible but having not really sat down to learn it properly yet it feels a bit hit and miss still.
configurations.archives.artifacts.clear()
Looks good to me!
8c7192d to
41335e4
Compare
|
I've applied the Anything else to address? |
dbfit-java/build.gradle
Outdated
There was a problem hiding this comment.
Can we have the commas at the end of lines.
dbfit-java/build.gradle
Outdated
There was a problem hiding this comment.
What about using the default it param here and in the source (the definitions would be able to fit in single lines).
a698250 to
7ad52a6
Compare
|
Horizontal tabs removed and I've replaced the iterator with the default Do you think the code should be squashed to fewer lines still? |
dbfit-java/build.gradle
Outdated
There was a problem hiding this comment.
I'm not sure if I can replace this iterator with it because of use in the inner iteration.
There was a problem hiding this comment.
Well, it does seem to work (see below) but is it (use of it in outer and inner iterations) too confusing?
task allJar(type: Jar, dependsOn: subprojects.build) {
baseName = 'dbfit'
subprojects.each {
from it.configurations.archives.allArtifacts.files.collect {
zipTree(it)
}
}
}
Yes, it looks a bit better to me if we squash these to one-liners. |
7ad52a6 to
33d868d
Compare
|
Converted to one liners now. What do you think of the formatting? |
It looks good to me now 👍 |
|
@MMatten - can we try to publish an initial snapshot version to Maven Central from this branch? |
|
Yes, no problem. I can do it (I already have a Sonatype login) or would you like to try (so that we can prove the process)? You can create a login instantly. You'll need to create a support issue in order to get upload access to the |
|
You'll need to create your own public/private key pair too and upload it to a public key server: |
|
OK, I can try to register tonight. |
|
I published via |
|
I can see the Let me take a look... |
|
Have you removed the That is if you're ready to publish |
|
No, I haven't changed the version number - it's not for final release yet. I just wondered if we should publish the snapshot to the target repo, but if it's not possible to delete/replace later - it doesn't seem a good idea. |
|
Ok. Cool. Once you uploaded the release version you should be able to publish it manually via the UI. You should be able to automatically download the artifacts from the snapshot repo though if you wanted to test including that in a test build. |
|
I've just spotted that I've not updated the publicly available dependencies to include I'll do that now. |
33d868d to
9902316
Compare
|
Cool, I'm merging. Thank you @MMatten for this great contribution! |
Publish dbfit jars to central
|
BTW, there is one special thing to consider - JDK version used to build the archives matters (I'm not sure if there is easy way to maintain e.g. both jvm7 and jvm8 artifacts). |
|
Won't the archives be usable with Java 7 when built with Java 8 as long as the compatibility was set to 7 (1.7)? Also, I'm trying to find out what the minimum Java version for FitNesse is. I can't find any info on the web site but Fitnesse starts up OK with Java 6. If I create that PR against the FitNesse project, to include basic/smoke testing of DbFit, there will be issues if they're still using Java 6 for their CI. Should we try to stay aligned with them and potentially go back to supporting Java 6!? |
To resolve #173.
uploadArchivestask creates additional JAR files instead of using the existing JAR output libraries: -then signs the archives and uploads to the appropriate (SNAPSHOT or release staging) Sonatype Maven repository.
All dependencies are published in the associated POM file. The exception is FitLibrary as the version currently used by DbFit isn't available from public repositories (a point for discussion).