skip to main | skip to sidebar

Tuesday, March 16, 2010

Recently I received an IntelliJ IDEA code style settings file for Hibernate Validator, the reference implementation of JSR 303 ("Bean Validation"), to which I'm contributing.

I wanted to import it into IntelliJ in order to format any code changes I make in the project's standard style. But as it turned out, there is no functionality within the IDE for importing code style settings. Instead one has to do the following:

  • Copy the settings XML file to INTELLIJ_SETTINGS_DIR/config/codestyles (where INTELLIJ_SETTINGS_DIR is the folder containing your IntelliJ settings; typically it is situated within your home directory, the name depends on your version of IntelliJ; in my case the complete path is "~/.IdeaIC90/config/codestyles")
  • Start IntelliJ
  • Go to "File" - "Settings" - "Code Style", select "Use global settings" and choose the previously imported style from the drop-down box
  • Optionally apply the style to one project only by clicking on "Copy to Project" and selecting "Use per project settings" afterwards
Eingestellt von Unknown um Tuesday, March 16, 2010
Labels: ,

8 comments:

Unknown said...

In Idea 10, use File -> Export/Import settings.
Which will allow you to select/deselect from many categories of settings (including code style).

April 19, 2011 at 6:26 PM
Unknown said...

Eric, that's great to know. That option wasn't available when I wrote this post. So things got definitely easier since then.

May 8, 2011 at 1:14 PM
Unknown said...

For those interested: In IntelliJ 11 on Mac, the settings directory is ~/Library/Preferences/IntelliJIdea11/codestyles/.

May 8, 2013 at 6:48 PM
Hyman said...

This is great!

September 25, 2013 at 10:47 AM
Magdalena said...

Actually the post is useful also now (with IntelliJ IDEA 14) because when I tried File -> Import settings I got
"Error reading file '/home/magdalena/Downloads/hibernate-style-steve-2.xml'.
There was error in opening zip file"
But coping to codestyles folder worked.

December 27, 2014 at 10:36 AM
Anonymous said...

With IntelliJ 14 (for OSX), I had to paste to the following folder: ~/Library/Preferences/IdealC14/codestyles/. Hope someone finds this useful. @Magdalena, I had the same error when trying to use the ide to import settings.

July 16, 2015 at 8:37 AM
GG. said...

This looks to be the perfect
London dominatrix

February 15, 2019 at 2:45 PM
Anonymous said...

FYI on IntelliJ IDEA 2021年3月2日 (Community Edition), to import and xml settings file you can use: Preferences > Editor > Code Style > (Gear Icon) > Import Scheme > IntelliJ IDEA code style XML

February 28, 2022 at 4:37 PM

Post a Comment

Subscribe to: Post Comments (Atom)
 

AltStyle によって変換されたページ (->オリジナル) /