Skip to content

Commit b72de57

Browse files
Merge pull request #121 from nextmv-io/merschformann/improve-java-gurobi-example-license-handling
Improves license handling in java-gurobi-knapsack app
2 parents 5f669bd + 62ede2a commit b72de57

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

java-gurobi-knapsack/.devcontainer/devcontainer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
},
1414
"workspaceMount": "source=${localWorkspaceFolder}/.,target=/app,type=bind",
1515
"workspaceFolder": "/app",
16+
"mounts": [
17+
"source=${localEnv:HOME}${localEnv:USERPROFILE}/gurobi.lic,target=/root/gurobi.lic,type=bind,consistency=cached"
18+
],
1619
"containerEnv": {
17-
"GRB_LICENSE_FILE": "./gurobi.lic"
20+
"GRB_LICENSE_FILE": "/root/gurobi.lic"
1821
}
1922
}

java-gurobi-knapsack/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ Example for running a Java `Maven` application on the Nextmv Platform using the
44
Gurobi solver. We solve a knapsack Mixed Integer Programming problem.
55

66
1. Setup license:
7-
1. **Local**: Add license file `gurobi.lic` to the root of the project.
8-
- If not using VS-Code's dev container, just place the `gurobi.lic` file
9-
in `$HOME/gurobi.lic` (Gurobi's default path for the license).
7+
1. **Local**:
8+
- You can simply place the `gurobi.lic` file in your _home directory_
9+
(like Gurobi expects it). If you are using the dev container, it will be
10+
mounted inside of the container for you.
1011
1. **Platform**: Don't forget to also define the license file as a
1112
[secret][secret] in your Nextmv Application as well. This can be easily
1213
done via [console].

java-gurobi-knapsack/java-gurobi-knapsack.code-workspace

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
"request": "launch",
1313
"mainClass": "com.nextmv.example.Main",
1414
"projectName": "GurobiJava",
15-
"env": {
16-
"GRB_LICENSE_FILE": "gurobi.lic"
17-
},
1815
"args": ["--input", "input.json", "--output", "output.json"]
1916
}
2017
]

0 commit comments

Comments
 (0)