I have a Spring Boot 2.x project that uses Gradle 7.x.
I'm assembling a distribution of the artifact/service in a zip / tar file using the built-in Spring Boot task(s) provided. There is no meta-data associated with this asset, nor any need to add anything else to it.
I would like to copy (or publish) this zip / tar file into Artifactory (using Gradle), but so far everything I see around that subject includes (1) the file itself (usually a jar), (2) module meta-data and (3) the POM file.
Is there a way to accomplish what I'm looking for?
Not exactly answers your question, but an easier approach would be to upload to Artifactory using the JFrog CLI:
$ curl -fL https://getcli.jfrog.io
$ ./jfrog rt upload \
--url="https://domain.tld" \
--user="some_user" \
--password="the_password" \
file_to_upload.zip path/within/artifactory/to/place/the/file/
For more information see Uploading Files.
Related
I'm currently migrating to Spring boot 3.0.
In the process, I'm looking into using the newly integrated Native support.
When using pack to build and publish my image, I get an error:
Executing native-image -H:+StaticExecutableWithDynamicLibC -jar /workspace
Error: /workspace is a directory. (-jar requires a valid jarfile)
Apparently, the native-image buildpack is trying to use the folder instead of jar.
I'm using this command to try to build the image.
pack -v build ghcr.io/kevinbos-cc/buildpacks-demo:latest \
--builder paketobuildpacks/builder:tiny \
--path . \
--env "BP_JVM_VERSION=17" \
--env "BP_NATIVE_IMAGE=true" \
--cache-image ghcr.io/kevinbos-cc/buildpacks-demo-paketo-cache-image:latest \
--publish
I've tried to change the paketo-buildpacks/java-native-image version and to use paketo-buildpacks/graalvm.
Unfortently these changes had the same result.
When running the ./gradle bootBuildImage the image is created just fine.
But I can't figure out how to reproduce this in the pack command.
Full stack trace can be found here.
If someone could point me in the right direction, that would be great!
I believe you're hitting an issue between Spring/Gradle & Buildpacks that is fairly common.
I think it was in Spring Boot 2.7, a setting was changed that causes Gradle builds, by default, to produce both a boot-ified and regular JAR file. By itself, this isn't a problem, but buildpacks need to handle multiple JAR files differently than a single JAR file, and some things like a native-image build still only work with single JAR files.
I know for sure that your build is producing two JAR files, as I can see in the output you linked. It says this:
Restoring multiple artifacts
so that's a pretty good sign that you're hitting this issue.
The good news is that this is an easy fix. You just need to tell Gradle to only build the boot-ified JAR.
In your build.gradle set this:
jar {
enabled = false
}
or build.gradle.kts:
tasks.getByName<Jar>("jar") {
enabled = false
}
See here or here for Kotlin.
If that doesn't help, you may be hitting a bug. In that case, please open an issue here and post a sample to reproduce.
I'm having a few issues with a spring-boot jar file that I have packaged in an RPM using the maven RPM plugin. The issue is it won't run if it has been compressed (which is what happens when it the jar file gets packaged in an RPM.)
I was wondering if there is any way to turn off/disable this RPM compression in a similar way that you can do in a zip file. I have already tried adding
%define _source_payload w0.gzdio
%define _binary_payload w0.gzdio
to my .spec file (through the rpm maven plugin) but the jar file is still being compressed.
RPM building does some post-processing on JAR files. See /usr/lib/rpm/redhat/brp-java-repack-jars for specifics.
See also: Packaging:Java and this old mailing list post.
I have created a new Java project in
eclipse-jee-kepler-SR2-win32-x86_64.
I have included the Jars in
flink-0.8.1\lib.
I have created the standard WordCount and it works.
I have modified my WordCount to take input from text files and csv files and it works.
all the imports work perfectly.
then i tried import org.apache.flink.api.java.io.jdbc.JDBCInputFormat.
Eclipse doesn't find it?
Why does Eclipse not find the import?
Because inside the jar flink-java-0.8.1.jar there is no directory io/jdbc.
I tried the same thing with flink-0.9.0-bin-hadoop27 and in the jar flink-dist-0.9.0.jar there is no org/apache/flink/api/java/io/jdbc directory. I uncompressed the jar and searched for the string "jdbcinputformat" with 0 results. I searched the string "jdbc" and it is only mentioned in org/apache/log4j, org/eclipse/jetty, and in other places that are not org.apache.flink.api.java.io
So my question is: Where do I find the class JDBCInputFormat?
What can I do to access SqlServer2012 in Flink (apart from accessing it outside Flink, create csv files, and then reading them in Flink (It sounds horrible to me since there should be a class specific for that))?
The corresponding module is not included. In order to use it, you need to build Flink from scratch. Run the following commands:
git clone https://github.com/apache/flink.git
cd flink
mvn -DskipTests clean install
This builds the latest snapshot for flink-0.10-SNAPSHOT. If you want to use stable version 0.9 run different git clone command:
git clone -b release-0.9 https://github.com/apache/flink.git
In your current project, you need to change the used Flink version in your pom file accordingly, eg, 0.10-SNAPSHOT or 0.9-SNAPSHOT.
I run my own little Maven repo for some open source. I have no dedicated server so I use a Google code repository, deploy to file system and then commit and push. Works perfect for me.
But some Maven tools are looking for a nexus-maven-repository-index.properties and the index (in GZ). I would like to generate this index to
get rid of the warning that it's not here
Maven doesn't try the repo for artefacts that are not there.
How can I do that? Is there a tool (Java main) that is able to generate an index? Also tips how to use the proper Nexus Jars with a little commandline tool are welcome.
I came across this post while I was searching for a solution to add a local repository to my Maven project using IntelliJ Idea.
Since Sonatype changed their paths and reorganized the downloads since the last post, here is an updated step-by-step tutorial to get your repository indexed for use with IntelliJ Idea:
Download the latest stand-alone indexer from here.
Extract it somewhere and go into this directory
From the console, run this command: export REPODIR=/path/to/your/local/repo/ && java org.sonatype.nexus.index.cli.NexusIndexerCli -r $REPODIR -i $REPODIR/.index -d $REPODIR/.index -n localrepo
In the directory .index within the repository directory, some files will be created including the file "nexus-maven-repository-index.gz" which is the file IntelliJ looks out for.
You can use the Maven Indexer CLI to product the index directly, but why bother hosting your own repo when OSS projects can use a hosted one for free?
http://nexus.sonatype.org/oss-repository-hosting.html
I was looking at maven indexer... but I am not sure what for is the last parameter indexDir in the method:
public RepositoryIndexer createRepositoryIndexer(String repositoryId,
File repositoryBasedir,
File indexDir)
is it like starting point in the repositoryBasedir?
Actually, I want to integrate spring javadoc with my netbeans IDE. Spring website only provides an HTML version javadoc online, no download link. But Netbeans only accept a jar/zip file or a local folder.
I know I can build it myself from spring source, but would rather not go through the work.
You can download from this location http://repo.spring.io/libs-release/org/springframework/spring/
You need the -with-docs.zip download
http://www.springsource.com/download/community
It seems the downloads are now managed with Maven only, however, if you want a copy of the JavaDocs locally you could use wget on the JavaDoc URL.
e.g. For release 3.0.5.RELEASE this works a treat.
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--domains docs.spring.io \
--no-parent \
http://docs.spring.io/spring/docs/3.0.5.RELEASE/javadoc-api/
Or you can just grab the version with source code (which is even better in your IDE anyway).
Sign up over at http://www.springsource.com or just grab it from a maven repository like this one:
http://www.jarvana.com/jarvana/browse/org/springframework/spring-jdbc/
Just grab the release you want (like 2.5.6/spring-jdbc-2.5.6-sources.jar), save to disk, and in Netbeans right-click on your library and select "add local sources".
/ Papa Freud
Using of Maven works for me. In the directory with pom.xml type the command:
mvn dependency:sources -DincludeArtifactIds=spring-aop -Dclassifier=javadoc
After that the jar is available in the ~/.m2 directory.
Now Spring uses artifactory.
Go to corresponding folder for further download.
http://repo.spring.io/webapp/browserepo.html?24