Modify

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)

2019-01-20-214623_1478x992_scrot.png (93.3 KB ) - added by simon04 6 years ago.
.idea.zip (2.5 KB ) - added by michael2402 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 / …

Download all attachments as: .zip

Change History (25)

comment:1 by Don-vip, 6 years ago

Owner: changed from team to anonymous
Status: newneedinfo

The wiki is maintained by the community, can you please update it? I have no idea what's missing, I'm using Eclipse.

comment:2 by anonymous, 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.

comment:3 by anonymous, 6 years ago

Oh, and I used the github mirror for getting the source.

comment:4 by simon04, 6 years ago

Owner: changed from anonymous to team
Status: needinfonew

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 anonymous, 6 years ago

Thanks, simon04. Although I already tried Gradle, somehow it didn't work. I'll have a second look.

comment:6 by anonymous, 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:7 by anonymous, 6 years ago

Gradle cannot import org.openstreetmap.josm.RevisionTask.

comment:8 by michael2402, 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)

Last edited 5 years ago by michael2402 (previous) (diff)

by michael2402, 5 years ago

Attachment: .idea.zip added

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 michael2402, 5 years ago

Summary: Revise IntelliJ related compiling guide[Patch] Revise IntelliJ related compiling guide

comment:10 by anonymous, 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 gaben, 5 years ago

Cc: gaben 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 Don-vip, 5 years ago

Reporter: changed from anonymous to gaben

comment:13 by hiddewie, 5 years ago

I am currently adding screenshots and many step-by-step items for getting started with IntelliJ and Ant.

comment:14 by gaben, 5 years ago

JOSM tree structure change may affect the guide, see #18845.

comment:15 by simon04, 5 years ago

Here is an updated guide including the changes from #18845 and #16860https://gist.github.com/simon04/08836edea15864e4b1010f960451369a

comment:16 by simon04, 4 years ago

Resolution: fixed
Status: newclosed

comment:17 by Klumbumbus, 4 years ago

Can you delete all the outdated information on wiki:/DevelopersGuide/CompilingUsingIntelliJ?

Last edited 4 years ago by Klumbumbus (previous) (diff)

comment:18 by simon04, 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:19 by Klumbumbus, 4 years ago

OK

comment:20 by gaben, 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 hiddewie, 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 skyper, 4 years ago

Resolution: fixed
Status: closedreopened

comment:23 by simon04, 4 years ago

Resolution: fixed
Status: reopenedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.