poplavr.blogg.se

Intellij export jar
Intellij export jar











  1. #INTELLIJ EXPORT JAR HOW TO#
  2. #INTELLIJ EXPORT JAR PLUS#

(I use 13.1, but could be valid for more versions) properties files which you don’t want to package along with your JAR) INTELLIJ (which is convenient if you work with env specific. Suppose you have a relative path referral like this in your code: new FileInputStream("xxxx.properties") jar is also quite different, but thats documented better.) Its maddening (cost my a whole evening to find out) but both IDE’s work quite different when it comes to looking for resource/propertty files when you want to run locally from your IDE or during debugging. You can also go to the ‘artifacts’ section and add the files to the artifacts manually.įor those of you who migrate from Eclipse to IntelliJ or the other way around here is a tip when working with property files or other resource files. It will show errors in the red part at the bottom and a ‘red lightbulb’ that when clicked shows you an option to add the files to the artifact.

intellij export jar

Intellij will give you the shortcut shown below.

  • Now you must add the properties files to the artifact.
  • Choose “classes” (even though they are not).
  • Intellij will now ask you what the “category” of the selected file is.
  • (I haven’t tried including an individual file)
  • Now select the folder that contains the property file(s).
  • #INTELLIJ EXPORT JAR PLUS#

    Click the green plus and select “Jars or directories”.On the right, select the Dependencies tab.In the list, select the module that you want to add one or more properties files to.Go to your project setup (CTRL + ALT + SHIFT + S).

    intellij export jar

    The setup below also works when you have a properties file that is shared by multiple modules. I apparently never added the properties files to the artifacts that required them, which is a separate step in Intellij.

    #INTELLIJ EXPORT JAR HOW TO#

    I spent quite a lot of time figuring out how to do this in Intellij 13x. If you want to test with different log4j configurations, it may be easier to specify a custom configuration file directly in the Run/Debug configuration, VM parameters filed like: It’s the same as the first way except you don’t need to add another Source root in the Module Paths settings, the file will be copied to the output directory on Make. Yet another solution would be to put the log4j.properties file directly under the Source root of your project (in the default package directory). Go to Project Structure | Modules | Your Module | Dependencies, click Add, Single-Entry Module Library, specify the path to the “resources” folder. If the Resource Patterns contains the extension of your resource, then it will be copied to the output directory when you Make the project and output directory is automatically a classpath of your application.Īnother common way is to add the “resources” folder to the classpath directly. Actually, you have at least 2 ways to do it, the first way is described by ColinD, you just configure the “resources” folder as Sources folder in IDEA.













    Intellij export jar