Opened 6 years ago
Closed 4 years ago
#17218 closed task (fixed)
[Patch] Revise IntelliJ related compiling guide
Reported by: | gaben | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Wiki content | Version: | |
Keywords: | Cc: | gaben |
Description
I tried IntelliJ get it to work following the steps on the wiki page, but some dependencies were missing and couldn't set up the IDE correctly. Ant helped me to build and run, but that's all. Using built-in running/testing/debugging config would be better.
https://josm.openstreetmap.de/wiki/DevelopersGuide/CompilingUsingIntelliJ
Attachments (2)
Change History (25)
comment:1 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → needinfo |
comment:2 by , 6 years ago
Now I only get 6 errors instead of 100. Currently the only file that fails is scripts\I18nSimilarStrings.java
, because can't import
org.openstreetmap.josm.gui.MainApplicationTest
and
org.openstreetmap.josm.plugins.PluginHandlerTestIT
Any idea? If I could set up the IDE, I can make the wiki update, probably next month.
by , 6 years ago
Attachment: | 2019-01-20-214623_1478x992_scrot.png added |
---|
comment:4 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | needinfo → new |
NB: Another good reason to move to Gradle eventually (#8269), IDE auto config, https://www.jetbrains.com/help/idea/gradle.html
I originally wrote this guide. I marked scripts/
as test root:
comment:5 by , 6 years ago
Thanks, simon04. Although I already tried Gradle, somehow it didn't work. I'll have a second look.
comment:6 by , 6 years ago
Finally, I can build the source with IntelliJ built-in tools. Now I have another problem. If I want to run JOSM, it fails because can't load the config files:
Unable to set SPI locale provider: null Unable to set SPI locale provider: null 2019-01-27 19:06:33.255 INFO: Log level is at INFO (INFO, 800) 2019-01-27 19:06:33.282 SEVERE: java.io.IOException: Failed to open input stream for resource 'resource://data/preferences.xsd' java.io.IOException: Failed to open input stream for resource 'resource://data/preferences.xsd' at org.openstreetmap.josm.io.CachedFile.getInputStream(CachedFile.java:230) at org.openstreetmap.josm.data.preferences.PreferencesReader.validateXML(PreferencesReader.java:96) at org.openstreetmap.josm.data.preferences.PreferencesReader.validateXML(PreferencesReader.java:85) at org.openstreetmap.josm.data.Preferences.load(Preferences.java:398) at org.openstreetmap.josm.data.Preferences.init(Preferences.java:509) at org.openstreetmap.josm.gui.MainApplication.mainJOSM(MainApplication.java:789) at org.openstreetmap.josm.gui.MainApplication$3.processArguments(MainApplication.java:284) at org.openstreetmap.josm.gui.MainApplication.main(MainApplication.java:711) 2019-01-27 19:06:36.187 WARNING: The revision file '/REVISION' is missing. 2019-01-27 19:06:36.448 SEVERE: Unable to register font DroidSans.ttf 2019-01-27 19:06:36.449 SEVERE: java.io.IOException: Failed to open input stream for resource 'resource://data/fonts/DroidSans.ttf' java.io.IOException: Failed to open input stream for resource 'resource://data/fonts/DroidSans.ttf' at org.openstreetmap.josm.io.CachedFile.getInputStream(CachedFile.java:230) at org.openstreetmap.josm.tools.FontsManager.initialize(FontsManager.java:40) at org.openstreetmap.josm.gui.MainApplication.mainJOSM(MainApplication.java:810) at org.openstreetmap.josm.gui.MainApplication$3.processArguments(MainApplication.java:284) at org.openstreetmap.josm.gui.MainApplication.main(MainApplication.java:711) 2019-01-27 19:06:36.450 SEVERE: Unable to register font DroidSans-Bold.ttf ...
The working directory is the root folder, I don't know why doesn't recognise the files :/
Ant run config works fine. Gradle doesn't yet.
comment:8 by , 5 years ago
This is what I tried:
- Check out JOSM SVN
- File → new → Project from existing source → Select JOSM SVN Directory
- Sources
- …/josm-svn/scripts com.intellij.ide.util.projectWizard.importSources.JavaModuleSourceRoot@62f77166
- …/josm-svn/src com.intellij.ide.util.projectWizard.importSources.JavaModuleSourceRoot@19d658b2
- …/josm-svn/test/functional com.intellij.ide.util.projectWizard.importSources.JavaModuleSourceRoot@32e00861
- …/josm-svn/test/performance com.intellij.ide.util.projectWizard.importSources.JavaModuleSourceRoot@4068c6fd
- …/josm-svn/test/unit com.intellij.ide.util.projectWizard.importSources.JavaModuleSourceRoot@5cfb463a
- …/josm-svn/tools/checkstyle/src com.intellij.ide.util.projectWizard.importSources.JavaModuleSourceRoot@59f7b7e2
- Libraries
- Deselect all test/data/…
- Deselect dist
- (those are probably still too many, but it won't hurt. Just make sure to compile with ANT before committing, so that you know if you used a wrong one in your code)
- Modules as suggested
- Select 1.8 JDK
- Deselect OSGi extension (we don't need it)
Then:
- Mark all dirs with generated code as excluded
- Mark resource directory 'data' for the main module
- styles / images / data are resources with the respective relative output path set.
- Exclude all SVN externals that are copied into the source dir and that do not really belong to JOSM (I don't know why they are even copied exactly there if they are exluded in the build any way)
- Make parsergen directory generated sources
- Add build.xml to ANT files
- Run ant task create-revision-eclipse before run
- Run ant task javacc before compilation
- Run ant task compile-cots before compilation
- Run ant task epsg before run
- Add junit maven dependency
- Fix many other dependecy stuff according to build.xml
- Create run configuration for JOSM
Important note: Since JOSM ant build does not differentiate between different modules and just puts all files in one big directory (which is currently the main reason we have with IDE integration and gradle setup), you should not run josm using ant (since this will pollute the build directory with compiled JOSM and not only CTOS classes and that would cause classes to be on the classpath twice)
by , 5 years ago
Extract this in the josm directory, then open with intellij. Working as of 2019-06-02, will fail as soon as someone changes a library version / …
comment:9 by , 5 years ago
Summary: | Revise IntelliJ related compiling guide → [Patch] Revise IntelliJ related compiling guide |
---|
comment:10 by , 5 years ago
I'm the OP. Thanks, I'll look at in the near future.
Based on what you wrote and my experiences, it seems much easier to give everyone the project files instead of the steps to setup manually. And just for the case the given config fails, give step by step setup guide as a fallback.
comment:11 by , 5 years ago
Cc: | added |
---|
Just registered, I'm the reporter.
Didn't forget, but haven't had the time to deal with the issue. It's on my queue.
comment:12 by , 5 years ago
Reporter: | changed from | to
---|
comment:13 by , 5 years ago
I am currently adding screenshots and many step-by-step items for getting started with IntelliJ and Ant.
comment:15 by , 5 years ago
Here is an updated guide including the changes from #18845 and #16860 – https://gist.github.com/simon04/08836edea15864e4b1010f960451369a
comment:16 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:17 by , 4 years ago
Can you delete all the outdated information?
comment:18 by , 4 years ago
Strictly speaking the old content is not outdated, but describes a different approach that is a bit less integrated since it relies less on IntelliJ and more on Ant tasks.
Maybe we can/should keep both?
comment:20 by , 4 years ago
The tutorial is already outdated unfortunately because of Ivy, and IntelliJ changed in 2020.1 release. Now by default, it doesn't have the config steps seen in the JOSM tutorial. It's still here, but hidden, see https://www.jetbrains.com/help/idea/2020.1/import-project-or-module-wizard.html
Who is not familiar with IntelliJ long enough will not know these options anytime existed. I opt for Simon's gist and deleting the old ones found here in the wiki.
comment:21 by , 4 years ago
Using the current guide without the Ivy integration/plugin within IntelliJ will not allow running tests and compiling test code from the IDE. This makes using an IDE half-useless.
Deleting all the old documentation and replacing it with the content in the gist seems like a good idea. The IdeaIvy plugin works well.
comment:22 by , 4 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:23 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
The wiki is maintained by the community, can you please update it? I have no idea what's missing, I'm using Eclipse.