How to include your github repository in gradle dependencies - github

There are a lot of questions like this, but none seem to either work for me or answer my question directly.
I'm using Jhipster and MongoDB Atlas. Jhipster uses a library called Mongobee has a method used in it that works for MongoDB, but not for MongoDB Atlas. To boot, Mongobee seems not to be maintained anymore.
So I found someone's suggested PR that they sent to Mongobee for review, I took the code changes, forked Mongobee, and added these changes in my own repository.
I want to add this to my build.gradle dependencies, but keep coming up with "could not resolve all files for configuration 'compileClasspath'
could not find com.github.myUserName:mongobee"
the URL to my repo:
https://github.com/myFakeUserName/mongobee
I've included jitpack.io in my
buildscript {
repositories{
mvn {url...}
}
I'm hoping to get this forked and modified repo to be included as a gradle dependency in my java based application.

Okay, after a long while, I think I finally understand.
1) jitpack can't be used in buildscripts
I learned that here What's the difference between buildscript and allprojects in build.gradle?
2) afterwards run ./gradlew install
3) run ./gradlew build --refresh-dependencies
4) crack a cold one ferda' bois'.
Now, I'm currently pointing to my local MongoDB instance. I'm going to try to point it at Mongo Atlas (which is outside the scope of the immediate question), and if this is successful, I'll add my repo I forked from mongobee and modified with some other user's code(to whom, I'll give credit to) that solves this issue Reading of DBname.system.indexes failed on Atlas cluster by mongobee after getting connected.

Related

How to update a maven dependency with a same version number in Azure Artifacts

We changed our maven private repository Nexus to Azure Artifacts.
And when we upload a private maven dependency with a some version, it told us below info:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
(default-deploy) on project HmapBasic: Failed to deploy artifacts:
Could not transfer artifact com.hand:HmapBasic:pom:3.0.3-RELEASE
from/to dev-azure-com-kohlerdevops-konnect-unified
(https://pkgs.dev.azure.com/KohlerDevOps/_packaging/Konnect-Unified/maven/v1/):
Failed to transfer file:
https://pkgs.dev.azure.com/KohlerDevOps/_packaging/Konnect-Unified/maven/v1/com/hand/HmapBasic/3.0.3-RELEASE/HmapBasic-3.0.3-RELEASE.pom.
Return code is: 409
I searched the code 409 error. It means we have already uploaded the dependency with this version and we can't upload this again.
We want to use the new dependency cover the old one without changing version(because if we change the version, all of our projects need to change pom.xml)
how can we do that in Azure Artifacts?
How to update a maven dependency with a same version number in Azure Artifacts
I am afraid you have to change the pom.xml, I understand how frustrating this is for you. But this is what Azure Artifacts deliberately designed to ensure the correctness of the build results.
Check the document: Understand immutability of packages.
Once you publish a particular version of a package to a feed, that
version number is permanently reserved. You cannot upload a newer
revision package with that same version number, or delete it and
upload a new package at the same version.
The reason for this design:
That because many package clients, including NuGet, keep a local cache
of packages on your machine. Once a client has cached a particular
package#version, it will return that copy on future install/restore
requests. If, on the server, you replace package#version (rev 1) with
a new package#version (rev 2), the client is unable to tell the
difference. the client still use the old version in cache. This can lead to indeterminate build results from
different machines.
So we could not overwrite all packages that have already been
uploaded, even we could not delete them and re-uploaded. To resolve
this issue, the only way is that upload the packages with a new
version.
Check my another thread for some more info.
Hope this helps.
I just made a test on Azure DevOps and if you use the "SNAPSHOT" suffix it will overwrite the previous package/artifact. For instance 2.0.0-SNAPSHOT.

Retrieve build info of a SNAPSHOT jar from artifactory using gradle

Before going forward, I realize this question is too broad. But I couldn't figure out the proper verbiage to search either here in SO or on GOOGLE.
If this question is a duplicate, then please excuse me in advance and provide me the link to the original question.
Problem :
We are working on creating testing framework. One of the requirements is to publish a report at the end of the testing phase with build information. We need to provide information like who committed the latest change we are testing, what is the build version we are using for testing etc.
In our current setup, We are using github as SCM. Whenever there is a commit to the SCM, a build is triggered on Jenkins and if the build is successful, the jar is deployed to JFrog Artifactory. I am trying to come up with a gradle script to get the necessary information.
Any pointers to the following questions are highly appreciated:
Which plugin can I use to retrieve the info for a SNAPSHOT jar from Artifactory?
Which plugin can I use to retrieve Jenkins build info using the build number retrieved from Q1?
Not sure this is what you were asking for, but have you looked into the Artifactory Build Info file?
The Artifactory Jenkins Plugin can collect build information for you and publish that information to the Artifactory server (If you choose to "collect and publish build info").
The build information can then be viewed on the artifactory server and also fetched using a simple REST call.
HTH,
Or

What grunt files to upload to repo vs files to upload when deploying site to production

So, I have a webapp I am creating using the 3 muskateers yeoman, grunt and bower.
My questions are:
What is best practice when it comes to uploading my webapp into a git/mercurial repo? Do I include the entire project? What about directories like 'node_modules' or 'test', etc?
Also, when deploying to live production site: Will my 'dist' folder be what I should be uploading?
With research yielding no results (I could be searching the wrong things?).. I'm a bit new to this process so any feedback is greatly appreciated. Thanks!
You should always commit all of your yeoman, grunt, and bower config files.
There are two schools of thought on committing the output they produce or dependencies they download:
One is, you should upload everything needed for another user to deploy the web app after cloning the repository, without performing any additional operations. The idea is, dependencies may not exist anymore, network connections might be down, etc.
Another is, keep the repository small and don't commit node_modules, etc, since they can be downloaded by the user.
As far as the dist folder goes, yes you'll be uploading it to your server, as it contains all of your minified files. Whether or not you want to commit it to the repository is a separate question. You might let the user build every time, assuming they can get all the dependencies one way or another (from above choice). Or you might want to commit it to tag it with a release version along with your source code.
There's some more discussion on this here: http://addyosmani.com/blog/checking-in-front-end-dependencies/

Can I download artifacts built by BuildHive?

I have started using the free Jenkins build service on BuildHive for one of my GitHub projects. This is also my first try doing anything with Maven. I have succeeded in building my project using this script on BuildHive:
cd base_dir
mvn package
The build log shows that the resulting JAR has been built. Now I would like to offer the JAR to my project's users as a download artifact because GitHub has discontinued the feature of manually uploading binaries in a separate download section.
Is there any way I can download an artifact, referencing it by a URL? If so, how do I construct the URL, knowing only the artifact's local path from the build log?
Alternatively, is there a way in which I can push the artifact to another place by adding a command to my build shell script after mvn package? I was thinking of something like a curl or ftpput commmand.
The best thing I was able to come up with as a quick workaround was to upload the artifacts in question to my FTP server via curl, as suggested by my original question. It works, but the downside are the FTP credentials in the build public log. I have counterbalanced that by a shell script on my DSL router which checks for FTP storage abuse every few minutes.
As an alternative I found that after creating a free CloudBees account for my little open source project, I got my own Jenkins build configuration as well as my own artifact repository where to deploy my build artifacts. This is much more elegant and does not involve posting any FTP credentials to a public server.
I am still open for BuildHive-only solutions if anyone has a smart idea. :-)

Indexed repositories within Artifactory

Apologies if this is obvious to everyone else...
I've deployed the Artifactory war file within tomcat6 and started the server: all looks great.
Now, I want to navigate around the preconfigured repositories, for instance repro1-cache. However, it appears it's empty, there are no tree elements to expand. This appears to be the story for all the listed repositories. Consequently I cant run any searches for particular artifacts.
Am I missing a stage here? Do I need to force it to index itself? What should I be expecting once I've deployed the war file and when I first log in?
I guess my expectation was that once having deployed the war file, Artifactory would automatically index the remote repositories. I'd then configure Eclipse to point at the Artifactory install, so that it can index the repositories within the IDE. Then when I declare a new dependency, Artifactory would download and cache it locally, allowing for faster resolution next time. Is this a valid expectation?
Any feedback will be most appreciated, particularly any pointers to user documentation that covers this that I've overlooked.
Your repositories are all empty because they aren't populated.
Once you deploy artifacts to the local repositories or request artifacts from remote repositories, you'll see them in the browser.
If you'd like to browse through artifacts not yet cached in remote repositories, you can use Artifactory's simple browser (see the Remote Browsing section).
Maven Indexes can be created and retrieved manually or as a recurring task; the Indexer can be configured in Artifactory's admin UI in Admin->Services->Indexer (also see the Indexer's wiki page).