intellij idea doesn't update properties file - intellij-idea

my project has a messages_tr.properties file outside of any sub-module. It is configured by this xml:
<bean id="messageSource" class="...ExposedResourceBundleMessageSource"> // derived from ReloadableResourceBundleMessageSource
<property name="basenames">
<list>
<value>file://${PROP_PATH}/messages</value>
...
</list>
</property>
<property name="cacheSeconds" value="40"/>
<property name="defaultEncoding" value="UTF-8"/>
<property name="fallbackToSystemLocale" value="false" />
</bean>
When I run project in debug mode, it works just fine. But, any change to the messages_tr.properties doesn't reflect. Neither editing any key-value pair, nor adding a new one.
I thought it maybe a Intellij Cache problem and tried several combinations of:
Invalidate Caches / Restart
Close Project, delete all .iml + .idea + target
restart computer
Rebuild + mvn clean install -DskipTests -P Profile
File -> Synchronize
VCS -> Refresh File Status
try on IE and Chrome Incognito, Chrome ctrl-f5
add ?*.properties to Settings -> Compiler -> Resource Patterns
I don't want to create a new property file just for this problem, and also it may not work too. I just run out of ideas.
What may prevent Intellij IDEA to update a property file? How can I resolve this?
EDIT: I have a key-value pair in this messages_tr.properties file like key = abcd and I edit it with editor to key = abcd222. Or I add a new pair key2 = abcd222. In the 1st case, message still comes as abcd and in the 2nd case, I get an error saying there is no key like key2. I mean editing content doesn't work.
PROP_PATH is a folder outside of any project module, here absolute path method is used. PROP_PATH is configured via server.xml in websphere configuration wlp folder. This configuration works, but editing doesn't reflect.

Related

How to prevent Intellij from creating a temporary run configuration and automatically switching to it

Intellij will create a greyed-out run configuration every time I execute an unsaved run operation from some menu, be that run a unit test, run a maven build, or some other execution from a menu item (there are a lot of ways to get a temporary run configuration).
These unsaved configurations are automatically switched to. Running anything changes the run configuration dropdown box at the top of the IDE, but I never asked for this behavior.
Is there a way to disable the automatic switching? I want to maintain my selection of the run configuration always and forever, amen. Stop Intellij from switching it for me.
Is there a way to disable the automatic creation of temporary run configurations, altogether? I never want to be bothered with temporary items in the run configuration inventory that I later feel like I need to clean up. Removes the clutter by never creating them in the first place.
2021.1 version no longer has this setting, issue reported.
As a workaround you can close the project and edit .idea/workspace.xml file manually.
Under <component name="PropertiesComponent"> node add/edit the following:
<property name="recentsLimit" value="0" />
For 2020.3.x and earlier versions:
Run/Debug Configurations | Templates | Temporary configurations limit: 0.
Now, you can find it in Settings | Advanced Settings | IDE

How to Build for Remote Server using MobileFirst CLI

I am building a bat file which automatically adds android environment to my worklight project and produce me with the apk file and worklight .war and .wlapp files to my destined location.
I have completed and everything works fine. i am using mfp bulid -d command to build the project and i have modifided the ant file in the MobileFirstServer Generator so that the above command give me .war file of the project.
Now my requirement is i want to build my project to a remote server so that my project.properties file in the android also gets updated with the serverip which i provide and i want to do this with the mobilefirst cli command since i am using a bat file and executing the commands.
I have seen this in the CLI build.xml file so this means if i have a build.properties file in my project anywhere i dont know exactly where it will take the ip,root,etc from that file.
XML
<!-- specify properties in this file or loaded from build.properties
<property name="worklight.server.install.dir" value=""/>
<property name="worklight.hostname" value="localhost"/>
<property name="worklight.port" value="10080"/>
<property name="worklight.username" value=""/>
<property name="worklight.password" value=""/>
<property name="worklight.app.dir" value=""/>
<property name="worklight.app.environments" value="common,iphone,android,blackberry10,windowsPhone8,windows8,ipad,mobileWebApp"/>
-->
In current releases of Worklight/MFP (6.x - 7.0), the CLI tool does not provide the ability to alter the IP address to a remote server prior to the build.
The workaround is to manually edit the wlclient.properties (Android, WP8) or worklight.plist (iOS) files in order for the application to connect to the remote server.
I have Done what i wanted via build.properties file.
Placed it in the Project folder of Worklight Project.
build.properties file has the following things in it
worklight.hostname=111.111.11.11
worklight.port=9090
Note: The above works only when internet connectivity is not present (i.e your ip-address should not be present for your system) This is an issue which i have noted. if your internet connectivity is there it will take your current ip address.

How to assign sources to Ivy library in IntelliJ IDEA?

I created a Webapp with an Ant/Ivy build using Spring framework and imported the project into IntelliJ IDEA. Using the IvyIDEA plugin the dependencies are resolved and a library with the jars is created automatically by the plugin.
How can I assign the sources (they are downloaded and stored in the ivy cache) to the Idea library so I can just click on a class of a dependency to browse the source?
To see ivy's cache libs I did these steps:
1) Add library folder (Choose Java from + menu):
2) "cache" item will be added to libraries. Choose all modules of your project that should now see "cache" library (you could also add inside 'dependency' tab on each module)
3) now you should tell intellij to check recursively inside cache folder. To do this you must edit a file as follows:
File is located in your project folder under .idea/libraries/cache.xml
<component name="libraryTable">
<library name="cache">
<CLASSES>
<root url="file://$USER_HOME$/.ivy2/cache" />
</CLASSES>
<JAVADOC />
<SOURCES />
<jarDirectory url="file://$USER_HOME$/.ivy2/cache" recursive="true" />
</library>
</component>
recursive property must be set to 'true'
It has to be explicitly enumerated in ivy.xml (at least in my Idea 11.1.5), i.e. sources are not shown for packages resolved as dependency of packages stated in ivy.xml. After introducing it is necessary to refresh modules (Tools->IvyIdea->resolve for ...).
See also:
https://code.google.com/p/ivyidea/issues/detail?id=92

Deploy WAR file to WAS. worklight.properties

Version: Worklight 6.0
I'm following the instructions in infocenter for deploying the war file to a standalone websphere application server 8.5 and there is one step that I do not understand.
http://pic.dhe.ibm.com/infocenter/wrklight/v6r0m0/index.jsp?topic=%2Fcom.ibm.worklight.help.doc%2Fdevref%2Fc_ant_tasks_sample_config_files.html
Step 5.
In the configureapplicationserver and unconfigureapplicationserver invocations (in target install and uninstall), define Worklight properties. For a list of properties that can be set, see Configuration of IBM Worklight applications on the server. In production, you must often define the following specific properties:
publicWorkLightHostname
publicWorkLightProtocol
publicWorkLightPort
In configureapplicationserver/unconfigureapplicationserver those properties do not exist, how do I define them and where and how do I use them in the ant file?
Or does this mean that before using this ant script I have to change the values of those properties in the worklight.properties file and (automatically) generate the WAR file? If this is the case I think it is not clear.
Thank you.
Define the three properties in install/uninstall target like this:
<property name="publicWorkLightHostname" value="myhost.com"/>
<property name="publicWorkLightProtocol" value="http"/>
<property name="publicWorkLightPort" value="9080"/>
Or you can set the three properties in worklight.properties file before running Ant. To set the properties, open the war file with tools like 7zip and modify the worklight.properties.

How can I load a .sql file when running a Maven/Hibernate project?

I am using hbm2ddl to create my tables and it works just fine but I also want hibernate to load a .sql file to populate the database each time I run my project.
I found that Hibernate should do this if my .sql file is in the classpath but it doesn't seem to work.
I am not sure if the file is in the classpath and I dont know how to find that out.
Currently my load.sql is in Other Sources/csr/main/resources/
I googled and read that I could add a file to te class path in the properties/libraries menu of my project but it seems Maven project doesn't have that section.
I am using Mysql with JDBC and Netbeans 7.1.2.
You have to specify which SQL file you want to load in your hibernate.xml
<hibernate-configuration>
<session-factory>
... some other stuff comes here
<property name="hibernate.hbm2ddl.auto">create-drop</property>
<property name="hibernate.hbm2ddl.import_files">
/import1.sql, /import2.sql
</property>
</session-factory>
<hibernate-configuration>
The script is only loaded if hbm2ddl.auto = create-drop. The import files are ignored on all other options
Note that only single line statements are allowed in this file.
Those two properties are described in the Hibernate Configuration, Chapter 3.4
You can use the sql-maven-plugin to do such things. This can run sql scripts etc. The hbm2ddl creates SQL scripts which can be executed by sql-maven-plugin.