-
1. Re: How to disable jandex for specific module?
jaikiran Jul 2, 2013 7:08 AM (in response to zhouyaguo)AFAIK, we do not write out any index at runtime. The indexes are generated at build time.
-
2. Re: How to disable jandex for specific module?
ctomc Jul 2, 2013 7:38 AM (in response to zhouyaguo)That is not jandex index but just index information about packages.
this is done first time module is accessed to speed up classloading
-
3. Re: How to disable jandex for specific module?
zhouyaguo Jul 2, 2013 12:30 PM (in response to zhouyaguo)Thanks for your reply, jaikiran and tomaz.
to jaikiran: AFAIK, only maven-resource with jandex="true" in build.xml will generate *-jandex.jar at build time.
to tomaz: You are right! it's not about jandex. My bad.
My original intent is to put my properites files outside my ear application. After following the [article](https://community.jboss.org/wiki/HowToPutAnExternalFileInTheClasspath) ,i touch a folder 'myconf' in $JBOSS_HOME and create a new module and use relative path to refer to $JBOSS_HOME/myconf, it's ok for me to get properties file from code inside ear.
But it's a little bit wierd to see myconf.index generated aside myconf. What's in myconf folder are just some properties files, not jars. How can i tell jboss modules not to generate .index for my specific module?
thanks again.
-
4. Re: How to disable jandex for specific module?
jaikiran Jul 3, 2013 2:24 AM (in response to zhouyaguo)Thanks to Tomaz, I now realize that this is a JBoss Modules feature where it writes out a index file (nothing to do with Jandex, by the way). JBoss Modules allows the usage of a system property to disable writing out these indexes and/or reading from the pre-existing indexes. But it's at the system level which means that it isn't applied per module. So if you disable it, then it gets disabled for all modules. I think it might be a good idea to open an enhancement in JBoss Modules JIRA https://issues.jboss.org/browse/MODULES asking for a way to be introduced for this to be done per module basis.
-
5. Re: How to disable jandex for specific module?
zhouyaguo Jul 3, 2013 10:27 AM (in response to jaikiran)Thanks to jaikiran. I've opened an enhancement in JBoss Modules. https://issues.jboss.org/browse/MODULES-170
I think it can be done through adding an new attribute aside slot attribute in module.xml and a 'if condition' in code.
-
6. Re: How to disable jandex for specific module?
raylite3 Jul 3, 2013 6:07 PM (in response to jaikiran)Hi, What is the system property to disable writing out the index?
-
7. Re: How to disable jandex for specific module?
zhouyaguo Jul 3, 2013 9:59 PM (in response to zhouyaguo)The system property is "jboss.modules.write-indexes"
source code:
The tag of jboss-modules used in JBoss AS 7.2.0.Final is:
<version.org.jboss.modules.jboss-modules>1.2.0.CR1</version.org.jboss.modules.jboss-modules>
In 1.2.0.CR1, org.jboss.modules.ResourceLoaders:
static {
WRITE_INDEXES = Boolean.parseBoolean(AccessController.doPrivileged(new PropertyReadAction("jboss.modules.write-indexes", "true")));
}
But from 1.2.0.Final on, org.jboss.modules.ResourceLoaders:
static {
USE_INDEXES = Boolean.parseBoolean(AccessController.doPrivileged(new PropertyReadAction("jboss.modules.use-indexes", "false")));
WRITE_INDEXES = USE_INDEXES && Boolean.parseBoolean(AccessController.doPrivileged(new PropertyReadAction("jboss.modules.write-indexes", "false")));
}
As you can see, the default value of WRITE_INDEXES is changed from true to false. BTW, it's still at the system level as jaikiran said.
-
8. Re: How to disable jandex for specific module?
raylite3 Jul 4, 2013 11:18 AM (in response to zhouyaguo)Thank you very much for the details!