Now that you have created your Java library, you can now push the generated artifact into your Gemfury account. To do that, you can use the Maven deploy function.
Configure Maven project
First, you will need to configure your Maven project. Add a new
repository entry in the
distributionManagement section on the
pom.xml of your project with your Repository URL. The
distributionManagement tag should be a direct child of your
pom.xml should include this:
<project xmlns=...> ... <distributionManagement> <repository> <id>fury-push</id> <name>Fury</name> <url>https://maven.fury.io/USERNAME/</url> </repository> </distributionManagement> ... </project>
USERNAME in the path of your Repository URL is the destination of the artifact. It may be your personal username if uploading to your personal repository, or an organization username if uploading to a shared repository.
Configure for remote server authentication
Second, you will need to configure Maven to use your push token to authenticate your uploads. You can do this in the user-specific configurations file, which is normally found in
- Update or create a
- Add a
servertag under a
serverssection, with an
idthat matches the repository id you used in your project’s
pom.xmlfile (for example
fury), then set
usernameto your push token and the keyword
Important: Maven will ignore the authentication config if the password is omitted or left blank. Please use the keyword
NOPASS in the password field to authenticate properly with Gemfury.
settings.xml file should look like this:
<settings xmlns=...> ... <servers> <server> <id>fury-push</id> <username>PUSH_TOKEN</username> <password>NOPASS</password> <configuration> <httpConfiguration> <all> <usePreemptive>true</usePreemptive> </all> </httpConfiguration> </configuration> </server> </servers> ... </settings>
usePreemptive setting is required to authenticate into your private Maven repository. Without it, you will only be able to access your public artifacts.
Deploy your artifact
After the configurations above, you can now use the Maven
deploy function to upload your artifacts.
$ mvn deploy
You can confirm the uploaded artifacts by visiting your Gemfury account’s dashboard.