|
| 1 | +{% set localSettingsXml = "~/.m2/settings-local.xml" %} |
| 2 | + |
| 3 | +# Building Strongbox using a Strongbox Instance |
| 4 | + |
| 5 | +We like our dog food and we try it all the time! :smiley: |
| 6 | + |
| 7 | +Working on Strongbox features is fun, but has a hidden issue - you can unintentionally break things. |
| 8 | +The best way to know if your changes are not affecting Strongbox is by testing it in a real-world environment. |
| 9 | +Building @strongbox/strongbox using a Strongbox instance is as "real world" environment as it can get and this |
| 10 | +article goes into details how to do the testing. |
| 11 | + |
| 12 | +## Starting a Strongbox Instance |
| 13 | + |
| 14 | +Before you start testing, you will need to have a running Strongbox instance. |
| 15 | + |
| 16 | +You can start Strongbox in two ways - via `spring-boot` and from `strongbox-distribution`. In most cases, during the |
| 17 | +development phase you will mainly start an instance via `spring-boot`. However once you are done with your task you |
| 18 | +should always ensure the `strongbox-distribution` package works as expected. |
| 19 | + |
| 20 | +``` linenums="1" tab="Strongbox via spring-boot" |
| 21 | +git clone {{repo_url}} |
| 22 | +mvn clean install -DskipTests |
| 23 | +cd strongbox-web-core |
| 24 | +mvn spring-boot:run |
| 25 | +``` |
| 26 | + |
| 27 | +``` linenums="1" tab="Strongbox from strongbox-distribution" |
| 28 | +git clone {{repo_url}} |
| 29 | +mvn clean install -DskipTests |
| 30 | +cd strongbox-distribution/target |
| 31 | +tar -zxf *gz |
| 32 | +cd strongbox-distribution-*/strongbox-*/ |
| 33 | +./bin/strongbox console |
| 34 | +``` |
| 35 | + |
| 36 | +## Building and Deploying using Strongbox |
| 37 | + |
| 38 | +Following the steps below should result in successful result: |
| 39 | + |
| 40 | +1. [Did you pay attention?][Strongbox Instance] |
| 41 | +2. Configure your `settings.xml` to point to the local [Strongbox Instance]: |
| 42 | + |
| 43 | + ``` tab="Download" |
| 44 | + # Linux / MacOS |
| 45 | + curl -o {{localSettingsXml}} \ |
| 46 | + {{resources}}/maven/settings-local.xml |
| 47 | + |
| 48 | + # Windows |
| 49 | + curl -o %HOMEPATH%\.m2\settings-local.xml ^ |
| 50 | + {{resources}}/maven/settings-local.xml |
| 51 | + ``` |
| 52 | +
|
| 53 | + ``` tab="Raw/Copy" |
| 54 | + --8<-- "{{resourcesPath}}/maven/settings-local.xml" |
| 55 | + ``` |
| 56 | +
|
| 57 | +3. Make a clean clone of @strongbox/strongbox into a separate path (i.e. `strongbox-tmp`) |
| 58 | +4. Build Strongbox using a Strongbox instance: |
| 59 | +``` |
| 60 | +$ cd strongbox-tmp |
| 61 | +$ mvn clean install -DskipTests -s {{localSettingsXml}} |
| 62 | +... (should start downloading artifacts from localhost:48080 |
| 63 | +[INFO] Scanning for projects... |
| 64 | +Downloading from strongbox: http://localhost:48080/storages/public/maven-group/org/carlspring/strongbox/strongbox-parent/1.0-SNAPSHOT/maven-metadata.xml |
| 65 | +Downloaded from strongbox: http://localhost:48080/storages/public/maven-group/org/carlspring/strongbox/strongbox-parent/1.0-SNAPSHOT/maven-metadata.xml (617 B at 1.7 kB/s) |
| 66 | +... |
| 67 | +[INFO] ------------------------------------------------------------------------ |
| 68 | +[INFO] BUILD SUCCESS |
| 69 | +[INFO] ------------------------------------------------------------------------ |
| 70 | +``` |
| 71 | +
|
| 72 | +5. Deploy into Strongbox |
| 73 | +``` |
| 74 | +$ mvn clean deploy \ |
| 75 | + -s {{localSettingsXml}} |
| 76 | + -DaltDeploymentRepository=snapshots::default::http://localhost:48080/storages/storage0/snapshots/ \ |
| 77 | + -DskipTests \ |
| 78 | + -fn |
| 79 | + |
| 80 | +... |
| 81 | +[INFO] --- maven-install-plugin:2.4:install (default-install) @ strongbox-masterbuild --- |
| 82 | +[INFO] Installing /java/strongbox-tmp/pom.xml to /java/strongbox-tmp/.m2/repository-strongbox-local/org/carlspring/strongbox/strongbox-masterbuild/1.0-SNAPSHOT/strongbox-masterbuild-1.0-SNAPSHOT.pom |
| 83 | +[INFO] |
| 84 | +[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ strongbox-masterbuild --- |
| 85 | +[INFO] Using alternate deployment repository snapshots::default::http://localhost:48080/storages/storage0/snapshots/ |
| 86 | +Downloading: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/1.0-SNAPSHOT/maven-metadata.xml |
| 87 | +Uploading: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/1.0-SNAPSHOT/strongbox-masterbuild-1.0-20180128.060409-1.pom |
| 88 | +Uploaded: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/1.0-SNAPSHOT/strongbox-masterbuild-1.0-20180128.060409-1.pom (4 KB at 5.6 KB/sec) |
| 89 | +Downloading: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/maven-metadata.xml |
| 90 | +Uploading: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/1.0-SNAPSHOT/maven-metadata.xml |
| 91 | +Uploaded: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/1.0-SNAPSHOT/maven-metadata.xml (618 B at 1.2 KB/sec) |
| 92 | +Uploading: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/maven-metadata.xml |
| 93 | +Uploaded: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/maven-metadata.xml (303 B at 0.6 KB/sec) |
| 94 | +... |
| 95 | +[INFO] ------------------------------------------------------------------------ |
| 96 | +[INFO] BUILD SUCCESS |
| 97 | +[INFO] ------------------------------------------------------------------------ |
| 98 | +``` |
| 99 | +
|
| 100 | +<!-- links --> |
| 101 | +[Strongbox Instance]: #starting-a-strongbox-instance |
0 commit comments