You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Building software can be tricky, but hopefully this won't be - thanks to [Gradle].
6
6
7
-
:::{note}
7
+
:::{admonition} You might not need this
8
8
Most people using QuPath won't need to build QuPath from source!
9
9
Just download an existing installer from [qupath.github.io](https://qupath.github.io) and use that instead.
10
10
@@ -45,8 +45,12 @@ cd qupath
45
45
:::
46
46
::::
47
47
48
-
:::{warning}
49
-
You'll need to type `gradlew` if you're using a standard command prompt on Windows, but `./gradlew` if you're using macOS, Linux, or Windows with some other shell prompt.
48
+
:::{admonition} Dot or not?
49
+
:class: warning
50
+
51
+
You'll need to type `gradlew` if you're using a standard command prompt on Windows.
52
+
53
+
You'll need `./gradlew` if you're using macOS, Linux, or Windows with some other shell prompt.
50
54
:::
51
55
52
56
It will take a few minutes to download everything required and build the software.
@@ -61,6 +65,8 @@ Example of command line build success
61
65
**That's it!**
62
66
You can find QuPath inside the `./build/dist/` subdirectory.
63
67
68
+
If it *didn't* go so well, check out [](#Troubleshooting).
69
+
64
70
:::{admonition} Which Java version do I need?
65
71
:class: tip
66
72
@@ -73,9 +79,33 @@ Switching to an OpenJDK distribution based on HotSpot may help -- see [here](htt
73
79
:::
74
80
75
81
76
-
### Customizing the build
82
+
## Running with Gradle
83
+
84
+
You can also run QuPath from the command line via Gradle, without needing to create the package.
85
+
86
+
To do this, replace `jpackage` above with `run` (and `clean` is optional).
87
+
The command would then be simply
88
+
89
+
::::{tab-set}
90
+
91
+
:::{tab-item} Windows
92
+
:sync: win
93
+
94
+
```bash
95
+
gradlew run
96
+
```
97
+
:::
98
+
99
+
:::{tab-item} macOS/Linux
100
+
:sync: nix
101
+
102
+
```bash
103
+
./gradlew run
104
+
```
105
+
:::
106
+
::::
77
107
78
-
####Creating installers
108
+
## Creating installers
79
109
80
110
If you need to create an installer for QuPath, you can use
81
111
@@ -124,23 +154,73 @@ Then I only need to call
124
154
rather than some elaborate command that includes all these options.
125
155
:::
126
156
127
-
#### Building a specific version
157
+
## Building a specific version
158
+
159
+
You can circumvent the need to use git entirely by downloading the QuPath code associated with a specific release from <http://github.com/qupath/qupath/releases>
160
+
161
+
Simply choose the *Source code (zip)* or *Source code (tar.gz)* option.
162
+
You can then build it from a command prompt as described above.
128
163
129
-
QuPath releases are associated with different git tags.
130
-
You can get the code associated with QuPath {{ env.config.release }} by using the command
164
+
Alternatively, you can get the code associated with a specific QuPath release using git tags.
165
+
For example, to get the code for QuPath {{ env.config.release }} use the command
131
166
132
167
```{eval-rst}
133
168
.. parsed-literal::
134
169
git checkout tags/v\ |release|\ -b\ v\ |release|
135
170
```
136
171
137
-
You can then try building it as above, however *note that some different versions may require different build commands* (e.g. the steps for v0.2.3 are slightly different from v0.3.0).
172
+
You can then try building it as above.
173
+
174
+
:::{admonition} Build commands might be different!
175
+
:class: warning
176
+
177
+
Some older QuPath versions might require different build commands (e.g. the steps for v0.2.3 are slightly different from v0.3.0).
138
178
Check out the docs associated with the specific version if this is the case.
179
+
:::
180
+
181
+
182
+
## Building with Fiji
183
+
By default, QuPath embeds a version of [ImageJ](https://imagej.net/software/imagej/).
184
+
This allows you to [send image regions to ImageJ, and even use custom ImageJ plugins](ImageJ).
185
+
186
+
[Fiji](https://fiji.sc) is a special distribution of ImageJ that contains a *lot* of custom plugins, and many extra features and other changes.
187
+
188
+
Thanks to [help from Curtis Rueden](https://forum.image.sc/t/embedding-fiji-inside-qupath/105065), since QuPath v0.6.0 it's possible to build QuPath with Fiji using
189
+
190
+
::::{tab-set}
191
+
192
+
:::{tab-item} Windows
193
+
:sync: win
194
+
195
+
```bash
196
+
./gradlew jpackage -Pfiji
197
+
```
198
+
:::
199
+
200
+
:::{tab-item} macOS/Linux
201
+
:sync: nix
202
+
203
+
```bash
204
+
./gradlew jpackage -Pfiji
205
+
```
206
+
:::
207
+
::::
208
+
209
+
Note that this will take some time to download everything it needs, and the package will be a *lot* bigger.
210
+
We also can't guarantee *everything* will work perfectly -- but most things we've tried seem to.
211
+
212
+
:::{figure} images/qupath-fiji.jpg
213
+
:class: shadow-image mid-image
214
+
215
+
QuPath built with Fiji
216
+
:::
139
217
140
218
## Other options
141
219
142
220
A few other ways to obtain and/or build QuPath's code are described below.
143
-
These might be better if you a) don't like the command line much, or b) want to make changes to the software.
221
+
These might be better if you
222
+
1. don't like the command line much, or
223
+
2. want to make changes to the software.
144
224
145
225
### GitHub Desktop
146
226
@@ -193,7 +273,7 @@ gradlew clean jpackage
193
273
Once you've built QuPath once, updating it to use the latest source code in *GitHub Desktop* should be easier.
194
274
The right-most button on the main toolbar serves two purposes: to {guilabel}`Fetch` information about the latest changes (from GitHub) and to {guilabel}`Pull` the changes down to your computer.
195
275
196
-
:::{figure} images/building-branches.png
276
+
:::{figure} images/building-fetch.png
197
277
:class: shadow-image full-image
198
278
199
279
The GitHub Desktop interface
@@ -204,32 +284,27 @@ If the option is {guilabel}`Fetch origin`, when you press the button the text wi
204
284
You can press it again to pull those changes, and then rebuild QuPath using `gradlew`.
205
285
206
286
:::{figure} images/building-pull.png
207
-
:class: shadow-image mid-image
287
+
:class: shadow-image full-image
208
288
209
289
Pulling changes from GitHub
210
290
:::
211
291
::::
212
292
213
-
### Download release
214
-
215
-
You can circumvent the need to use git entirely by downloading the QuPath code associated with a specific release from <http://github.com/qupath/qupath/releases>
216
-
217
-
Simply choose the *Source code (zip)* or *Source code (tar.gz)* option.
218
-
You can then build it from a command prompt as described above.
219
293
220
294
### Running from an IDE
221
295
222
296
You should be able to import QuPath into any IDE (e.g. *IntelliJ*, *Eclipse*) that supports Gradle.
223
297
224
298
#### IntelliJ IDEA
225
299
226
-
I personally use [IntelliJ IDEA] for QuPath development, which allows me to run
227
-
the software in debug mode -- and even change the code while it is running.
300
+
The QuPath devs mostly use [IntelliJ IDEA] for QuPath development.
301
+
This allows us to run the software in debug mode -- and even change the code while it is running.
228
302
229
303
To do this, you can either:
230
304
231
305
* download and build QuPath once as described above, then use {menuselection}`Open` from within IntelliJ, and navigate to the directory containing the QuPath code, or
232
-
* use {menuselection}`Get from VCS` in IntelliJ to download the code directly from GitHub using git. To do this, you should use the URL `https://github.com/qupath/qupath.git` (or the URL to your own git repository housing the QuPath code).
306
+
* use {menuselection}`Get from VCS` in IntelliJ to download the code directly from GitHub using git.
307
+
To do this, you should use the URL `https://github.com/qupath/qupath.git` (or the URL to your own git repository housing the QuPath code).
233
308
234
309
If you download the code using this approach, you should make sure you have installed a Java JDK before proceeding any further (see instructions above).
235
310
@@ -260,6 +335,37 @@ to reload the changes *while QuPath is running*.
260
335
Provided they aren't *too* extreme, the changes will be incorporated into the software without needing to relaunch it.
261
336
However, any major changes that alter method signatures (e.g. adding or removing arguments, or changing return types) will require QuPath to be relaunched.
262
337
338
+
## Troubleshooting
339
+
340
+
Two fairly common things can go wrong when attempting to build QuPath:
341
+
1. The version of Java used to run Gradle is too old - *even if the right version is installed*
342
+
* Fix this by telling Gradle more insistently which Java version to use, via `-Dorg.gradle.java.home`
343
+
2. Javadocs are unavailable -- or a firewall is blocking access to them
344
+
* Fix this by adding `-x javadoc` to the Gradle command used to build QuPath, to skip the javadocs
345
+
346
+
Both are described [in this post on image.sc](https://forum.image.sc/t/building-qupath-0-6-0-rc5-from-source/113232).
0 commit comments