### Create NuGet Package (Example)
Source: https://strongbox.github.io/user-guide/tool-integration/nuget-mono-example.html
An example output of the nuget.exe pack command, indicating successful package creation.
```bash
carlspring@linux-70e2:/home/carlspring/strongbox-examples/hello-strongbox-nuget-mono> mono --runtime=v4.0 nuget.exe pack ./Hello.Strongbox.Nuget.Mono.nuspec
Attempting to build package from 'Hello.Strongbox.Nuget.Mono.nuspec'.
Successfully created package '/home/carlspring/strongbox-examples/hello-strongbox-nuget-mono/Org.Carlspring.Strongbox.Examples.Nuget.Mono.1.0.nupkg'.
```
--------------------------------
### Example Strongbox YAML Configuration
Source: https://strongbox.github.io/user-guide/configuration-files/strongbox-yaml.html
This snippet shows a comprehensive example of a strongbox.yaml file, demonstrating various repository types, configurations, and group setups.
```yaml
groupRepositories:
- carlspring
- maven-central
- apache-snapshots
- jboss-public-releases
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
nugget.org:
id: nuget.org
policy: release
dataStore: file-system
layout: NuGet
type: proxy
remoteRepository:
url: https://www.nuget.org/api/v2
repositoryConfiguration:
type: NuGet
remoteFeedPageSize: 1000
storage-springsource-proxies:
id: storage-springsource-proxies
repositories:
springsource-snapshots:
id: springsource-snapshots
policy: snapshot
dataStore: file-system
layout: Maven 2
type: proxy
remoteRepository:
url: http://repo.spring.io/snapshot
downloadRemoteIndexes: true
autoBlocking: true
checksumValidation: true
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
springsource-releases:
id: springsource-releases
policy: release
dataStore: file-system
layout: Maven 2
type: proxy
remoteRepository:
url: http://repo.spring.io/libs-release
downloadRemoteIndexes: true
autoBlocking: true
checksumValidation: true
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
springsource-milestones:
id: springsource-milestones
policy: release
dataStore: file-system
layout: Maven 2
type: proxy
remoteRepository:
url: http://repo.spring.io/milestone
downloadRemoteIndexes: true
autoBlocking: true
checksumValidation: true
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
springsource-proxies:
id: springsource-proxies
policy: mixed
dataStore: file-system
layout: Maven 2
type: group
secured: true
groupRepositories:
- springsource-snapshots
- springsource-releases
- springsource-milestones
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
storage-ivy-proxies:
id: storage-ivy-proxies
repositories:
typesafe-releases:
id: typesafe-releases
policy: release
dataStore: file-system
layout: Maven 2
type: proxy
remoteRepository:
url: https://repo.typesafe.com/typesafe/releases
downloadRemoteIndexes: true
autoBlocking: true
checksumValidation: true
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
typesafe-ivy-releases:
id: typesafe-ivy-releases
policy: release
dataStore: file-system
layout: Maven 2
type: proxy
remoteRepository:
url: https://repo.typesafe.com/typesafe/ivy-releases
downloadRemoteIndexes: true
autoBlocking: true
checksumValidation: true
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
group-ivy-proxies:
id: group-ivy-proxies
policy: release
dataStore: file-system
layout: Maven 2
type: group
secured: true
groupRepositories:
- typesafe-releases
- typesafe-ivy-releases
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
storage-sbt-proxies:
id: storage-sbt-proxies
repositories:
sbt-plugin-releases:
id: sbt-plugin-releases
policy: release
dataStore: file-system
layout: Maven 2
type: proxy
remoteRepository:
url: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases
downloadRemoteIndexes: true
```
--------------------------------
### Example API Key Setting Output
Source: https://strongbox.github.io/user-guide/tool-integration/nuget-visual-studio-example.html
This is an example of the output after successfully setting the API key for a repository.
```bash
nuget.exe setApiKey eyJhbGciOiJIUzI1NiJ9. -Source http://localhost:48080/storages/storage-nuget/nuget-releases
The API Key 'eyJhbGciOiJIUzI1NiJ9.' was saved for 'http://localhost:48080/storages/storage-nuget/nuget-releases'.
```
--------------------------------
### Test Get All Examples Response
Source: https://strongbox.github.io/developer-guide/how-to-implement-spring-controllers.html
Tests the endpoint for retrieving all examples, asserting that the response status is OK and the 'examples' list is not empty.
```java
@Test
public void testGetExamplesResponse()
throws Exception
{
given().accept(MediaType.APPLICATION_JSON_VALUE)
.contentType(MediaType.APPLICATION_JSON_VALUE)
.when()
.get("/example-controller/all")
.peek() // Use peek() to print the output
.then()
.statusCode(HttpStatus.OK.value())
.body("examples", hasSize(greaterThan(0)));
}
```
--------------------------------
### Start Strongbox from Distribution
Source: https://strongbox.github.io/developer-guide/building-strongbox-using-strongbox-instance.html
Use this command to start a Strongbox instance from its distribution package. This is useful for testing the final distribution build. Ensure you have cloned the repository and installed it locally.
```bash
git clone https://github.com/strongbox/strongbox
mvn clean install -DskipTests
cd strongbox-distribution/target
tar -zxf *gz
cd strongbox-distribution-*/strongbox-*
./bin/strongbox console
```
--------------------------------
### Install Strongbox using RPM on Linux
Source: https://strongbox.github.io/user-guide/getting-started.html
Installs Strongbox using an RPM package and optionally configures it to start on system boot.
```bash
# Open a terminal
# First, make sure you have a JRE with version 1.8
# installed on your system. You can use your favorite package manager
# to find one.
sudo rpm -ivh /path/to/strongbox-distribution-*.rpm
# If you just want to start Strongbox without installing the systemd service:
su strongbox
/opt/strongbox/bin/strongbox console
# If you want to configure strongbox to start at system, boot:
sudo systemctl enable strongbox.service
sudo service strongbox start
```
--------------------------------
### Install Strongbox using Tar on Linux
Source: https://strongbox.github.io/user-guide/getting-started.html
Installs Strongbox by extracting a tar archive, setting up users and permissions, and optionally starting it as a systemd service.
```bash
# Open a terminal
sudo su
mkdir /opt/strongbox /opt/strongbox-vault
groupadd strongbox
useradd -d /opt/strongbox -g strongbox -r strongbox
chown -R strongbox:strongbox /opt/strongbox /opt/strongbox-vault
chmod -R 770 /opt/strongbox /opt/strongbox-vault
su strongbox
tar -zxf /path/to/strongbox-distribution*.tar.gz \
-C /opt/strongbox \
--strip-components=2
# If you just want to start Strongbox without installing the systemd service:
/opt/strongbox/bin/strongbox console
# If you want to install Strongbox as a service then download the
systemd service file. Make sure to change the `Environment` variables
in the service file where necessary. Depending on your distribution,
you could also move the environment variables into `EnvironmentFile`
and load that instead.
sudo curl -o /etc/systemd/system/strongbox.service \
https://strongbox.github.io/assets/resources/systemd/strongbox.service
sudo systemctl deamon-reload
sudo service strongbox start
# this step is optional: only if you want to start Strongbox at boot!
sudo systemctl enable strongbox
```
--------------------------------
### Example Output of Python Package Build
Source: https://strongbox.github.io/user-guide/tool-integration/pypi-example.html
This is an example of the output generated when building a Python package using `setup.py`.
```text
python3 setup.py sdist bdist_wheel
running sdist
running egg_info
creating hello_world_pypi.egg-info
writing hello_world_pypi.egg-info/PKG-INFO
writing dependency_links to hello_world_pypi.egg-info/dependency_links.txt
writing requirements to hello_world_pypi.egg-info/requires.txt
writing top-level names to hello_world_pypi.egg-info/top_level.txt
writing manifest file 'hello_world_pypi.egg-info/SOURCES.txt'
reading manifest file 'hello_world_pypi.egg-info/SOURCES.txt'
writing manifest file 'hello_world_pypi.egg-info/SOURCES.txt'
running check
creating hello-world-pypi-1.0.0
creating hello-world-pypi-1.0.0/hello-world-pypi
creating hello-world-pypi-1.0.0/hello_world_pypi.egg-info
copying files to hello-world-pypi-1.0.0...
copying README.md -> hello-world-pypi-1.0.0
copying setup.cfg -> hello-world-pypi-1.0.0
copying setup.py -> hello-world-pypi-1.0.0
copying hello-world-pypi/__init__.py -> hello-world-pypi-1.0.0/hello-world-pypi
copying hello-world-pypi/helloworld.py -> hello-world-pypi-1.0.0/hello-world-pypi
copying hello_world_pypi.egg-info/PKG-INFO -> hello-world-pypi-1.0.0/hello_world_pypi.egg-info
copying hello_world_pypi.egg-info/SOURCES.txt -> hello-world-pypi-1.0.0/hello_world_pypi.egg-info
copying hello_world_pypi.egg-info/dependency_links.txt -> hello-world-pypi-1.0.0/hello_world_pypi.egg-info
copying hello_world_pypi.egg-info/requires.txt -> hello-world-pypi-1.0.0/hello_world_pypi.egg-info
copying hello_world_pypi.egg-info/top_level.txt -> hello-world-pypi-1.0.0/hello_world_pypi.egg-info
Writing hello-world-pypi-1.0.0/setup.cfg
creating dist
Creating tar archive
removing 'hello-world-pypi-1.0.0' (and everything under it)
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/hello-world-pypi
copying hello-world-pypi/__init__.py -> build/lib/hello-world-pypi
copying hello-world-pypi/helloworld.py -> build/lib/hello-world-pypi
installing to build/bdist.macosx-10.12-x86_64/wheel
running install
running install_lib
creating build/bdist.macosx-10.12-x86_64
creating build/bdist.macosx-10.12-x86_64/wheel
creating build/bdist.macosx-10.12-x86_64/wheel/hello-world-pypi
copying build/lib/hello-world-pypi/__init__.py -> build/bdist.macosx-10.12-x86_64/wheel/hello-world-pypi
copying build/lib/hello-world-pypi/helloworld.py -> build/bdist.macosx-10.12-x86_64/wheel/hello-world-pypi
running install_egg_info
Copying hello_world_pypi.egg-info to build/bdist.macosx-10.12-x86_64/wheel/hello_world_pypi-1.0.0-py3.7.egg-info
running install_scripts
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build/bdist.macosx-10.12-x86_64/wheel/hello_world_pypi-1.0.0.dist-info/WHEEL
creating 'dist/hello_world_pypi-1.0.0-py3-none-any.whl' and adding 'build/bdist.macosx-10.12-x86_64/wheel' to it
adding 'hello-world-pypi/__init__.py'
adding 'hello-world-pypi/helloworld.py'
adding 'hello_world_pypi-1.0.0.dist-info/LICENSE'
adding 'hello_world_pypi-1.0.0.dist-info/METADATA'
adding 'hello_world_pypi-1.0.0.dist-info/WHEEL'
adding 'hello_world_pypi-1.0.0.dist-info/top_level.txt'
adding 'hello_world_pypi-1.0.0.dist-info/RECORD'
removing build/bdist.macosx-10.12-x86_64/wheel
```
--------------------------------
### Configure Default Push Repository URL (Example)
Source: https://strongbox.github.io/user-guide/tool-integration/nuget-mono-example.html
An example of setting the DefaultPushSource for the NuGet.config file.
```bash
$ mono --runtime=v4.0 nuget.exe config -set DefaultPushSource=http://localhost:48080/storages/storage-nuget/nuget-releases -ConfigFile ./.nuget/NuGet.config
```
--------------------------------
### Install and Run Strongbox on Windows
Source: https://strongbox.github.io/user-guide/getting-started.html
Instructions for unzipping the Strongbox distribution and running it from the command line, including installing it as a service.
```bash
# Unzip the distribution.
# To start Strongbox, run cmd or PowerShell and execute:
c:\java\strongbox> bin\strongbox.bat console
wrapper | Strongbox: Distribution started...
# To install Strongbox as a service, run cmd or PowerShell and execute:
c:\java\strongbox> bin\strongbox.bat install
wrapper | Strongbox: Distribution installed.
c:\java\strongbox> bin\strongbox.bat start
```
--------------------------------
### Set API Key for Repository (Example)
Source: https://strongbox.github.io/user-guide/tool-integration/nuget-mono-example.html
An example of setting the API key for a repository source in the NuGet.config file.
```bash
carlspring@linux-70e2:/home/carlspring/strongbox-examples/hello-strongbox-nuget-mono> mono --runtime=v4.0 nuget.exe setApiKey bXktYXBpLWtleQ== -Source http://localhost:48080/storages/storage-nuget/nuget-releases -ConfigFile ./.nuget/NuGet.config
The API Key 'bXktYXBpLWtleQ==' was saved for 'http://localhost:48080/storages/storage-nuget/nuget-releases'.
```
--------------------------------
### Install a NuGet Package
Source: https://strongbox.github.io/user-guide/tool-integration/nuget-visual-studio-example.html
Execute this command to install a found NuGet package into your project. The output shows the dependency resolution and installation process.
```powershell
Install-Package hello-strongbox-nuget-visual-studio
```
--------------------------------
### Install Strongbox using DEB on Linux
Source: https://strongbox.github.io/user-guide/getting-started.html
Installs Strongbox using a DEB package and optionally configures it to start on system boot or removes it.
```bash
# Open a terminal
# First, make sure you have a JRE with version 1.8
# installed on your system. You can use your favorite package manager
# to find one.
# Install:
sudo dpkg -i /path/to/strongbox-*.deb
# If you just want to start Strongbox without installing the systemd service:
su strongbox
/opt/strongbox/bin/strongbox console
# If you want to configure strongbox to start at system, boot:
sudo systemctl enable strongbox
sudo systemctl start strongbox
# Remove the package:
sudo dpkg -r strongbox
# Purge configuration files, note this does not remove strongbox-vault:
sudo dpkg -P strongbox
```
--------------------------------
### Start Strongbox via Spring Boot
Source: https://strongbox.github.io/developer-guide/building-strongbox-using-strongbox-instance.html
Use this command to start a Strongbox instance during development using Spring Boot. Ensure you have cloned the repository and installed it locally.
```bash
git clone https://github.com/strongbox/strongbox
mvn clean install -DskipTests
cd strongbox-web-core
mvn spring-boot:run
```
--------------------------------
### Start Strongbox Distribution and Monitor Logs
Source: https://strongbox.github.io/developer-guide/upgrading-dependencies-and-plugins.html
Deploys and starts the strongbox distribution from its target directory. It also tails the log files for real-time monitoring during startup and operation.
```bash
cd strongbox-distribution/target
tar -zxf *gz
cd strongbox-distribution-*/strongbox-*
bin/strongbox console
```
```bash
tail -n 500 -F logs/*log
```
--------------------------------
### Example Package.nuspec File
Source: https://strongbox.github.io/user-guide/tool-integration/nuget-visual-studio-example.html
This is an example of a Package.nuspec XML file. Remember to replace placeholder tokens and ensure 'authors' and 'description' are mandatory.
```xml
Package
1.0.2
gokhan.kuyucak
gokhan.kuyucak
http://LICENSE_URL_HERE_OR_DELETE-THIS-LINE
http://PROJECT_URL_HERE_OR-DELETE-THIS-LINE
http://ICON_URL_HERE_OR-DELETE-THIS-LINE
false
An example to generate package and publish with strongbox
Summary of changes made in this release of the package.
Copyright 2018
Tag1 Tag2
```
--------------------------------
### Example strongbox.yaml Configuration
Source: https://strongbox.github.io/user-guide/configuration-files/strongbox-yaml.html
This is a complete example of a strongbox.yaml file. It covers instance-level settings, CORS configuration, and definitions for multiple storage configurations, including hosted and proxy repositories.
```yaml
configuration:
instanceName: strongbox
version: ${project.version}
revision: ${strongbox.revision}
baseUrl: http://localhost:48080/
port: 48080
sessionConfiguration:
timeoutSeconds: 3600
remoteRepositoriesConfiguration:
checkIntervalSeconds: 60
heartbeatThreadsNumber: 5
retryArtifactDownloadConfiguration:
timeoutSeconds: 60
maxNumberOfAttempts: 5
minAttemptsIntervalSeconds: 5
corsConfiguration:
allowedCredentials: true
maxAge: 600
allowedOrigins:
- "*"
allowedMethods:
- GET
- PUT
- POST
- DELETE
- OPTIONS
allowedHeaders:
- Accept
- Accepts
- Authorization
- Access-Control-Allow-Headers
- Access-Control-Request-Headers
- Access-Control-Request-Method
- DNT
- Keep-Alive
- User-Agent
- X-Requested-With
- If-Modified-Since
- Cache-Control
- Content-Type
- Content-Range,Range
storages:
storage0:
id: storage0
repositories:
releases:
id: releases
policy: release
dataStore: file-system
layout: Maven 2
type: hosted
allowsForceDeletion: true
checksumHeadersEnabled: true
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
snapshots:
id: snapshots
policy: snapshot
dataStore: file-system
layout: Maven 2
type: hosted
secured: true
checksumHeadersEnabled: true
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
storage-common-proxies:
id: storage-common-proxies
repositories:
maven-central:
id: maven-central
policy: release
dataStore: file-system
layout: Maven 2
type: proxy
remoteRepository:
url: https://repo.maven.apache.org/maven2/
downloadRemoteIndexes: true
autoBlocking: true
checksumValidation: true
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
carlspring:
id: carlspring
policy: mixed
dataStore: file-system
layout: Maven 2
type: proxy
remoteRepository:
url: https://repo.carlspring.org/content/groups/carlspring
downloadRemoteIndexes: true
autoBlocking: true
checksumValidation: true
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
apache-snapshots:
id: apache-snapshots
policy: snapshot
dataStore: file-system
layout: Maven 2
type: proxy
remoteRepository:
url: https://repository.apache.org/snapshots/
downloadRemoteIndexes: true
autoBlocking: true
checksumValidation: true
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
jboss-public-releases:
id: jboss-public-releases
policy: release
dataStore: file-system
layout: Maven 2
type: proxy
remoteRepository:
url: http://repository.jboss.org/nexus/content/groups/public-jboss/
downloadRemoteIndexes: true
autoBlocking: true
checksumValidation: true
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
maven-oracle:
id: maven-oracle
policy: release
dataStore: file-system
layout: Maven 2
type: proxy
remoteRepository:
url: https://maven.oracle.com
downloadRemoteIndexes: true
autoBlocking: true
checksumValidation: true
allowsDirectoryBrowsing: false
repositoryConfiguration:
type: Maven 2
indexingEnabled: true
cronExpression: "0 0 2 * * ?"
metadataExpirationStrategy: checksum
group-common-proxies:
id: group-common-proxies
policy: release
dataStore: file-system
layout: Maven 2
type: group
secured: true
```
--------------------------------
### Example .npmrc Configuration
Source: https://strongbox.github.io/user-guide/tool-integration/npm-example.html
Configure your .npmrc file with Strongbox registry details, authentication, and email.
```ini
registry=http://localhost:48080/storages/storage-npm/npm-releases
always-auth=true
email=someuser@example.com
_auth=YWRtaW46cGFzc3dvcmQ=
; `_auth` is a base64 encoded authentication token
; you can use it instead of:
; username=admin
; _password=password
```
--------------------------------
### Enable OrientDB Studio from Distribution
Source: https://strongbox.github.io/developer-guide/getting-started-with-persistence.html
Start Strongbox from the distribution with OrientDB Studio enabled using the STRONGBOX_ORIENTDB_STUDIO_ENABLED environment variable.
```bash
$ cd /opt/strongbox
$ STRONGBOX_VAULT=/opt/strongbox-vault STRONGBOX_ORIENTDB_STUDIO_ENABLED=true ./bin/strongbox console
```
--------------------------------
### Example strongbox-authorization.yaml File
Source: https://strongbox.github.io/user-guide/configuration-files/strongbox-authorization-yaml.html
This snippet shows how to define user-defined roles and their associated privileges in the strongbox-authorization.yaml file.
```yaml
authorizationConfiguration:
roles:
- name: ANONYMOUS_ROLE
description: Common anonymous user role
privileges:
- ARTIFACTS_RESOLVE
- SEARCH_ARTIFACTS
- name: USER_ROLE
description: Common user role
privileges:
- VIEW_USER
- name: CUSTOM_ROLE
description: Deployment role
privileges:
- Deploy
```
--------------------------------
### Install Strongbox using Tar on macOS
Source: https://strongbox.github.io/user-guide/getting-started.html
Installs Strongbox by extracting a tar archive, creating a user, setting up directories and permissions, and optionally loading it as a LaunchDaemon.
```bash
# Open a terminal
sudo su
sysadminctl -addUser strongbox
mkdir -p /opt/strongbox /opt/strongbox-vault
chown -R strongbox:staff /opt/strongbox /opt/strongbox-vault
chmod -R 770 /opt/strongbox /opt/strongbox-vault
su strongbox
tar -zxf /path/to/strongbox-distribution*.tar.gz \
-C /opt/strongbox \
--strip-components=2
# If you just want to start Strongbox without installing the launchctl service:
/opt/strongbox/bin/strongbox console
# If you want to install Strongbox as a LaunchDaemon then download the
plist file. If you've customized the installation, edit the details
in the plist file where necessary.
# (This file must be owned by root.)
sudo curl -o /Library/LaunchDaemons/strongbox.plist \
https://strongbox.github.io/assets/resources/launchctl/strongbox.plist
# This will validate that launchd can load the file and start the service.
sudo launchctl load /opt/strongbox/etc/strongbox.plist
# Strongbox will now start on boot.
```
--------------------------------
### Example Yarn Publish Output
Source: https://strongbox.github.io/user-guide/tool-integration/yarn-example.html
This is an example of the output you can expect when successfully publishing an npm package using Yarn to a Strongbox registry.
```text
$ yarn publish v1.19.1
+ [1/4] Bumping version...
+ info Current version: 1.0.0
+ question New version: 1.0.0
+ [2/4] Logging in...
+ [3/4] Publishing...
+ success Published.
+ [4/4] Revoking token...
+ Done in 4.50s.
```
--------------------------------
### Install Package with Chocolatey (Windows)
Source: https://strongbox.github.io/user-guide/tool-integration/nuget-chocolatey-example.html
Use this command to install a package from a specific repository URL on Windows. Ensure you run this command as an administrator.
```powershell
choco install hello-chocolatey -s "%REPO_URL%"
```
--------------------------------
### Docker Installation for Strongbox
Source: https://strongbox.github.io/user-guide/getting-started.html
Information regarding Docker installation for Strongbox. Currently unavailable, with plans for future release to Docker Hub.
```bash
Currently unavailable due to our heavy development.
We are planning to start releasing to hub.docker.com very soon.
Meanwhile, you could clone strongbox/strongbox
use `docker-compose up` instead.
```
--------------------------------
### Cloning Strongbox and Starting with Docker Compose
Source: https://strongbox.github.io/developer-guide/building-the-code-with-docker.html
This sequence of commands clones the Strongbox repository and then uses Docker Compose to build and start a Strongbox instance from the source code.
```bash
git clone https://github.com/strongbox/strongbox.git
cd strongbox
docker-compose up
```
--------------------------------
### ExampleController Java Implementation
Source: https://strongbox.github.io/developer-guide/how-to-implement-spring-controllers.html
A comprehensive example controller demonstrating various Spring MVC annotations and patterns for handling HTTP requests.
```Java
package org.carlspring.strongbox.controllers;
import org.carlspring.strongbox.controllers.support.ExampleEntityBody;
import org.carlspring.strongbox.forms.ExampleForm;
import org.carlspring.strongbox.validation.RequestBodyValidationException;
import java.util.Arrays;
import java.util.List;
import io.swagger.annotations.*;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* This oversimplified example controller is written following the How-To-Implement-Spring-Controllers guide.
* It's purpose is entirely educational and is meant to help newcomers.
*
* https://github.com/strongbox/strongbox/wiki/How-To-Implement-Spring-Controllers
*
* @author Przemyslaw Fusik
* @author Steve Todorov
*/
@RestController
@RequestMapping("/example-controller")
@Api(value = "/example-controller")
public class ExampleController
extends BaseController
{
public static final String NOT_FOUND_MESSAGE = "Could not find record in database.";
@ApiOperation(value = "List available examples")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Everything went ok") })
@GetMapping(value = "/all",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = { MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity getExamples()
{
List list = Arrays.asList("a", "foo", "bar", "list", "of", "strings");
return getJSONListResponseEntityBody("examples", list);
}
@ApiOperation(value = "Show specific example")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Everything went ok") })
@GetMapping(value = "/get/{example}",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = { MediaType.TEXT_PLAIN_VALUE,
MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity getExample(@ApiParam(value = "Get a specific example", required = true)
@PathVariable String example,
@RequestHeader(HttpHeaders.ACCEPT) String accept)
{
if (example.equals("not-found"))
{
return getNotFoundResponseEntity(NOT_FOUND_MESSAGE, accept);
}
ExampleEntityBody body = new ExampleEntityBody(example);
return ResponseEntity.ok(body);
}
@ApiOperation(value = "Update example's credentials.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Everything went ok"),
@ApiResponse(code = 400, message = "Validation errors occurred") })
@PostMapping(value = "/update/{example}",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = { MediaType.TEXT_PLAIN_VALUE,
MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity updateExample(
@ApiParam(value = "Update a specific example using form validation", required = true)
@PathVariable String example,
@RequestHeader(HttpHeaders.ACCEPT) String accept,
@RequestBody(required = false) @Validated ExampleForm exampleForm,
BindingResult bindingResult)
{
if (example.equals("not-found"))
{
return getNotFoundResponseEntity(NOT_FOUND_MESSAGE, accept);
}
// In case of form validation failures - throw a RequestBodyValidationException.
// This will be automatically handled afterwards.
if (exampleForm == null)
{
throw new RequestBodyValidationException("Empty request body", bindingResult);
}
if (bindingResult.hasErrors())
{
throw new RequestBodyValidationException("Validation error", bindingResult);
}
return getSuccessfulResponseEntity("Credentials have been successfully updated.", accept);
}
@ApiOperation(value = "Delete an example")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Everything went ok"),
@ApiResponse(code = 404, message = "Example could not be found.") })
@DeleteMapping(value = "/delete/{example}",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = { MediaType.TEXT_PLAIN_VALUE,
MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity deleteExample(@ApiParam(value = "Delete a specific example", required = true)
@PathVariable String example,
@RequestHeader(HttpHeaders.ACCEPT) String accept)
{
if (example.equals("not-found"))
{
```
--------------------------------
### Build Project with Maven
Source: https://strongbox.github.io/developer-guide/building-the-code-with-docker.html
Executes a Maven clean install command within the Docker container to build the project.
```bash
mvn clean install
```
--------------------------------
### Ant build.xml Example
Source: https://strongbox.github.io/user-guide/tool-integration/ant-ivy-example.html
This Ant build script compiles code, creates a JAR artifact, and publishes it to the Strongbox artifact repository.
```xml
```
--------------------------------
### Install strongbox Locally with Integration Tests
Source: https://strongbox.github.io/developer-guide/upgrading-dependencies-and-plugins.html
Installs the strongbox project into your local Maven repository, running integration tests to ensure stability. Use this after updating the parent POM in the strongbox project.
```bash
mvn clean install -Dintegration.tests
```
--------------------------------
### Run All Docker Compose Services
Source: https://strongbox.github.io/developer-guide/writing-web-integration-tests.html
Finds all docker-compose.yml files in the current directory and its subdirectories and starts the services defined in them using docker-compose up.
```bash
find . -maxdepth 2 -type f -name "docker-compose.y*ml" -exec docker-compose -f {} up \;
```
--------------------------------
### GroupId-Level Plugin Information Example
Source: https://strongbox.github.io/developer-guide/metadata/maven-metadata.html
This XML file lists available plugins under a specific groupId. It contains only plugin information and no version details.
```xml
Maven Derby Plugin
derby
derby-maven-plugin
LittleProxy Maven Plugin
little-proxy
little-proxy-maven-plugin
Maven Artifact Relocation Plugin
relocation
relocation-maven-plugin
```
--------------------------------
### Checkout and Build Strongbox with DockerMvn
Source: https://strongbox.github.io/developer-guide/building-the-code-with-docker.html
Uses the dockerMvn helper command to automatically checkout the strongbox/strongbox.git repository and run a Maven clean install.
```bash
dockerMvnCheckout
```
--------------------------------
### Verify Directory and Upload Package
Source: https://strongbox.github.io/developer-guide/writing-web-integration-tests.html
Checks if a directory exists and then uploads a Python package using the pip command. Asserts the successful installation of the package.
```groovy
// Assert directory exists for package uploaded
Path packageDirectoryPath = uploadPackageDirectoryPath.resolve("dist");
boolean pathExists = Files.isDirectory(packageDirectoryPath,
LinkOption.NOFOLLOW_LINKS);
assert pathExists == true
// upload python package using pip command
runCommand(uploadPackageDirectoryPath, packageUploadCommand)
def commandOutput
// Install uploaded python package using pip command and assert success
def uploadedPackageName = "pip_upload_test"
commandOutput = runCommand(uploadPackageDirectoryPath, pipInstallPackageCommand + " " + uploadedPackageName)
assert commandOutput.contains("Successfully installed " + uploadedPackageName.replace("_" , "-") + "-1.0")
```
--------------------------------
### Add Original Remote Repository
Source: https://strongbox.github.io/developer-guide/building-the-code.html
This command sets up the original Strongbox repository as a remote named 'strongbox'. This is a one-time setup task for syncing forks.
```bash
git remote add strongbox https://github.com/strongbox/strongbox.git
```
--------------------------------
### SBT Build and Deployment Output Example
Source: https://strongbox.github.io/user-guide/tool-integration/sbt-example.html
This output demonstrates a successful compilation and publishing process to a Strongbox repository, including artifact details and deployment URLs.
```bash
carlspring@linux-70e2:/home/carlspring/strongbox-examples/hello-strongbox-sbt> sbt
[info] Set current project to hello-strongbox-sbt (in build file:/home/carlspring/strongbox-examples/hello-strongbox-sbt/)
> compile
[success] Total time: 0 s, completed Apr 30, 2016 4:54:22 AM
> run
[info] Running Main
Hello, Strongbox!
[success] Total time: 0 s, completed Apr 30, 2016 4:54:23 AM
> publish
[info] Wrote /home/carlspring/strongbox-examples/hello-strongbox-sbt/target/scala-2.10/hello-strongbox-sbt_2.10-1.0-SNAPSHOT.pom
[info] :: delivering :: org.carlspring.strongbox.examples#hello-strongbox-sbt_2.10;1.0-SNAPSHOT :: 1.0-SNAPSHOT :: integration :: Sat Apr 30 04:54:30 BST 2016
[info] delivering ivy file to /home/carlspring/strongbox-examples/hello-strongbox-sbt/target/scala-2.10/ivy-1.0-SNAPSHOT.xml
[info] published hello-strongbox-sbt_2.10 to http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/examples/hello-strongbox-sbt_2.10/1.0-SNAPSHOT/hello-strongbox-sbt_2.10-1.0-SNAPSHOT.pom
[info] published hello-strongbox-sbt_2.10 to http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/examples/hello-strongbox-sbt_2.10/1.0-SNAPSHOT/hello-strongbox-sbt_2.10-1.0-SNAPSHOT.jar
[info] published hello-strongbox-sbt_2.10 to http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/examples/hello-strongbox-sbt_2.10/1.0-SNAPSHOT/hello-strongbox-sbt_2.10-1.0-SNAPSHOT-sources.jar
[info] published hello-strongbox-sbt_2.10 to http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/examples/hello-strongbox-sbt_2.10/1.0-SNAPSHOT/hello-strongbox-sbt_2.10-1.0-SNAPSHOT-javadoc.jar
[success] Total time: 2 s, completed Apr 30, 2016 4:54:30 AM
```
--------------------------------
### Prepare Project Workspace
Source: https://strongbox.github.io/user-guide/tool-integration/nuget-mono-example.html
Creates necessary directories and a basic NuGet configuration file. Ensure these folders are added to your VCS ignore list.
```bash
$ mkdir -p ./bin
$ mkdir -p ./.nuget
$ echo '' > ./.nuget/NuGet.config
```
--------------------------------
### Test Get Specific Example Response
Source: https://strongbox.github.io/developer-guide/how-to-implement-spring-controllers.html
Tests the endpoint for retrieving a specific example by its ID, verifying that the response status is OK and the 'name' field is present.
```java
@Test
public void testGetExampleResponse()
throws Exception
{
given().accept(MediaType.APPLICATION_JSON_VALUE)
.contentType(MediaType.APPLICATION_JSON_VALUE)
.when()
.get("/example-controller/get/foo-bar")
.peek() // Use peek() to print the output
.then()
.statusCode(HttpStatus.OK.value())
.body("name", not(nullValue()));
}
```
--------------------------------
### Test Get Non-Existing Example Response
Source: https://strongbox.github.io/developer-guide/how-to-implement-spring-controllers.html
Tests the endpoint for retrieving a non-existent example, expecting an OK status code. Further assertions would typically follow to check for specific error messages or structures.
```java
@Test
public void testGetNonExistingJsonExampleResponse()
throws Exception
{
given().accept(MediaType.APPLICATION_JSON_VALUE)
.contentType(MediaType.APPLICATION_JSON_VALUE)
.when()
.get("/example-controller/get/not-found")
```
--------------------------------
### Testing REST Calls with RestAssured
Source: https://strongbox.github.io/developer-guide/writing-tests.html
A simple example demonstrating how to send an HTTP GET request to a '/greeting' endpoint using rest-assured. Ensure the necessary import statement is included in your test.
```java
given().when()
.get("/greeting")
.then()
.statusCode(200);
```
--------------------------------
### Install Python Package from Strongbox
Source: https://strongbox.github.io/user-guide/tool-integration/pypi-example.html
Install a Python package from a Strongbox PyPI repository using `pip install` with the `--extra-index-url` option. This allows pip to find packages hosted on your Strongbox instance.
```bash
pip3 install --extra-index-url http://localhost:48080/storages/storage-pypi/pypi-releases hello-world-pypi
```
```text
Looking in indexes: https://pypi.org/simple, http://localhost:48080/storages/storage-pypi/pypi-releases
Collecting hello-world-pypi
Downloading http://localhost:48080/storages/storage-pypi/pypi-releases/packages/hello_world_pypi-1.0.0-py3-none-any.whl
Processing /Users/ankit.tomar/Library/Caches/pip/wheels/95/70/6e/0f8362d968f0fef63006a07ba4158ac5d921fbcc664f976db3/pip_hello_world-0.1-cp37-none-any.whl
Installing collected packages: pip-hello-world, hello-world-pypi
Successfully installed hello-world-pypi-1.0.0 pip-hello-world-0.1
```
--------------------------------
### Specify Custom Maven Settings File
Source: https://strongbox.github.io/developer-guide/getting-started.html
Demonstrates how to use a custom Maven settings file with the 'mvn' command.
```bash
mvn -s ~/.m2/settings-strongbox.xml clean install
```
--------------------------------
### Create a NuGet Package
Source: https://strongbox.github.io/user-guide/tool-integration/nuget-visual-studio-example.html
Use the `nuget pack` command to create a NuGet package from a project's .csproj file. Ensure all necessary metadata like description and author are specified for a complete package.
```bash
nuget pack ./hello-strongbox-nuget-visual-studio/hello-strongbox-nuget-visual-studio.csproj
```
```text
Attempting to build package from 'hello-strongbox-nuget-visual-studio.csproj'.
MSBuild auto-detection: using msbuild version '15.5.180.51428' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin'.
Packing files from 'hello-strongbox-nuget-visual-studio\hello-strongbox-nuget-visual-studio\bin\Release'.
WARNING: Description was not specified. Using 'Description'.
WARNING: Author was not specified. Using 'gokhan.kuyucak'.
Successfully created package 'hello-strongbox-nuget-visual-studio.1.0.0.nupkg'.
```
--------------------------------
### Install strongbox-parent Locally
Source: https://strongbox.github.io/developer-guide/upgrading-dependencies-and-plugins.html
Installs the updated strongbox-parent project into your local Maven repository. This command is essential after modifying the parent POM.
```bash
mvn clean install
```
--------------------------------
### Configure Accepted Artifact Routing Rules
Source: https://strongbox.github.io/user-guide/artifact-routing-rules.html
This example demonstrates how to configure accepted routing rules. It specifies that artifacts matching certain patterns should be accepted by specific repositories within group repositories. Use this to allow artifact resolution from designated repositories based on URL patterns.
```xml
...
```
--------------------------------
### Install Package with Chocolatey (Linux)
Source: https://strongbox.github.io/user-guide/tool-integration/nuget-chocolatey-example.html
Use this command to install a package from a specific repository URL on Linux. Ensure you run this command as an administrator.
```bash
choco install hello-chocolatey -s "$REPO_URL"
```
--------------------------------
### Build and Deploy with Maven
Source: https://strongbox.github.io/user-guide/tool-integration/maven-example.html
Execute this command to build your project and deploy artifacts to Strongbox. Ensure your Maven settings are configured to point to your Strongbox instance.
```bash
mvn clean deploy
```