Can't take jar from artifactory - build.gradle

I have a jar file in the Artifactory which I published.
Now I want to take that jar file to build my code in the gradle script.
I have jars in the "commonlibs-snapshot-local/UTIL/UTIL-2.jar" path.
In the URL I am giving this path as "url of artifactory/commonlib-snapshot-local/".
In the dependencies section I'm giving like
dependencies {
compile " UTIL/UTIL-2.jar"
}
I have checked so many times: Still getting error like UTIL could not found.
Please help me.

Your JAR should be referenced in Artifactory by a GAV (Group Artifact Version)
You can see the Gradle dependency declaration in Artifactory
Try and copy that in your gradle script.
Adrian M. point out in the comments to "gradle publish does not include dependencies in pom", adding a missing from components.java in
publishing {
publications {
jar(MavenPublication) {
from components.java
groupId libraryGroupId
version libraryVersion
artifactId libraryArtifactId
artifact("$buildDir/libs/${artifactId}-${libraryVersion}.jar")
}
}
}

Related

Passing the ArchiveName to UploadArchives in gradle

Having migrated from Spring Boot 1.5.19 to Spring Boot 2.0.4, we are encountering problems with the build on jenkins. Using gradle 4.2.1. We think the behavioural changes in the spring boot gradle plugin between the versions is causing our issue.
The spring Boot gradle plugin has also been updated from 1.5.19 to 2.0.4
Our target artefact naming convention is :
project-name-<version>-<branch>-RELEASE.jar
The jar file gets generated correctly, having specified the following in the build.gradle file.
bootJar {
baseName = 'project_name'
}
The problem occurs when the uploadArchives task is executed. This task looks for an artefact with the following naming convention.
<path-folder-name>-<version>-<branch>-RELEASE.jar
where is the name of the folder path on the jenkins.
It doesn’t seem to be picking up the baseName config.
The build pipeline runs successfully when we don’t perform the uploadArchives task. Also, prior to the Spring Boot upgrade, this was not an issue.
Is there a way to get uploadArchives task to look for the generated jar file name?
I resolved this eventually by adding a settings.gradle file and defining a a root project name in that
rootProject.name = "project_name"
I think the upgrading of the spring Boot gradle plugin must have changed the way the project was being defined.
The 1.5.* version seemed to be taking the project name from the baseName in the Jar task, but the newer version was using the folder name where the app sits.
That was fun

class <cucumber> cannot be resolved to a type - also not able to import cucumber.junit.api.Cucumber

Attached screenshot shows the project setup and jars included. Can somebody please help me what is that I would have done wrong.
Cucumber class is present in cucumber-junit-1.2.5.jar file.
Try to use this dependency: https://mvnrepository.com/artifact/info.cukes/cucumber-junit/1.2.5 in maven.
I tried many ways to resolve this issue, finally I downloaded
this jar file cucumber-junit-1.2.5.jar and then I highlighted my project, then
clicked on Project > Properties> Java Build Path> Libraries>
Maven Dependencies > Add External Jar file .....and opened my downloaded file and
added it to Maven dependencies and error disappeared.

Typings install gives 'No dependencies' as output

I am trying to install a Ionic 2 template.
Following the readme gets until the point where I need to install typings dependencies. After the installation of the typings CLI with npm install typings --global, I should install all the dependencies stated in the typings.json package (already provided by the template in the project folder).
This is how the typings.json file looks like:
{
"dependencies": {},
"devDependencies": {},
"ambientDependencies": {
"cordova": "registry:dt/cordova#0.0.0+20160316155526",
"cordova/plugins/statusbar": "registry:dt/cordova/plugins/statusbar#0.0.0+20160316155526",
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#4de74cb527395c13ba20b438c3a7a419ad931f1c"
}
}
As stated in the title, it gives me No dependencies as output and it doesn not install anything contained in that config file.
Could it be something related to having installed typings with sudo as a global package? Maybe it is looking for a config file in another directory?
Thanks!
This is most likely the update from 0.* to 1.*. Check the release notes
https://github.com/typings/typings/releases/tag/v1.0.0
Changes
Many breaking changes (see https://github.com/typings/core/releases/tag/v1.0.0)
Renamed ambient to global
Updated typings/ directory structure (removed browser.d.ts by default, should use typings/index.d.ts by default)
Killed defaultAmbientSource (no more auto-install of DefinitelyTyped when using --ambient, explicitly use dt~)
Replace ! parser expansion symbol with ~ (! is a reserved bash symbol)
Ability to specify different resolutions and output directories using resolution in typings.json
Using tslint-config-standard for linting rules
Fixing it for me was just replacing "devDependencies" with "globalDependencies" in my typings.json.
I had the same problem. I had to install node.js again (there was a newer version when I installed it again, 6.2.0) with the installer, node-sass with npm (I don't know if you need this one) and then the installation of typings worked.

Failed sqljdbc4 connection when in executable JAR

I have a GUI application that connects to a SQL Server 2008 database using sqljdbc4.jar. If I run this from the command line it works great.
However, once I wrap it into an executable JAR, I get a "No suitable driver found for jdbc:sqlserver://myServer:1433;databaseName=myDb" error. I know that my Windows system CLASSPATH is ignored once it's in a JAR, but I can't figure out include the sqljdbc4.jar within the executable JAR and get a portable application.
My most recent attempt to fix this is as follows:
My MANIFEST.MF file:
Manifest-Version: 1.0
Class-Path: lib/sqljdbc4.jar
Created-By: 1.7.0_11 (Oracle Corporation)
Main-Class: MyApp
The command I use to compile the JAR:
jar cmf MANIFEST.MF MyApp.jar MyApp.class help.html lib
My directory structure is below. I am running the jar command inside the MyApp directory.
+ MyApp
+ lib
- sqljdbc.jar
- help.html
- MANIFEST.MF
- MyApp.class
- MyApp.java
When I create the JAR and run it inside the MyApp directory, it works fine. As soon as I pull it out of the directory, I get the error. How can I make the JAR access the sqljdbc.jar that is available internally?
Thanks in advance.
When you have an executable jar MyApp.jar with entry in the manifest.mf:
Class-Path: lib/sqljdbc4.jar
This means that the jar has an external dependency to sqljdbc4.jar in the (relative) folder lib. It is not included in the jar you created! So you need to make sure that there is a lib-folder containing sqljdbc4.jar relative to that jar when you execute it. So the folder structure when executing needs to be;
+ (a folder)
+ lib
- sqljdbc.jar
- MyApp.jar

gwtprojsonserializer 1.0.4 jar - error serializing arraylist

I am using gwtprojsonserializer to convert objects to JSON. I've added the version 1.0.4 jar I downloaded from the website http://code.google.com/p/gwtprojsonserializer/ but although the source code on the website includes functionality for serializing arraylists, it is not included in the jar and hence i get the following error:
com.kfuntak.gwt.json.serialization.client.SerializationException: Can't find object serializer for java.util.ArrayList
Does anyone know how I can update the jar or use their latest source code?
Thanks in advance.
Its open source project. The entire source code can be easily downloaded from http://code.google.com/p/gwtprojsonserializer/source/browse/#svn%2Ftrunk
I am assuming the required code for serializing arraylists is in trunk. You can add/remove/modify on you local copy. Build the jar ( it just requires mvn clean install command)
If you are having local repository, use mvn deploy. Ensure your version id is different to avoid confusion.