RE: Configuration file for service builder

Bernd S, modified 5 Years ago. Junior Member Posts: 59 Join Date: 3/31/15 Recent Posts
First off, sorry for asking so many question these days but I seem to run into walls non-stop while working with Liferay 7.0
This time I tried to use a configuration file for my service builder project. Therfeore I followed https://portal.liferay.dev/docs/7-0/tutorials/-/knowledge_base/t/making-your-applications-configurable.

package at.test.config;
import aQute.bnd.annotation.metatype.Meta;

@Meta.OCD(id = "at.test.config.ServiceConfiguration", name = "Service-Configuration")
public interface ServiceConfiguration {
    @Meta.AD(deflt = "DEFAULT", description = "Parameter to test the configuration", name = "test", required = false)
    public String test();
}


But after creating the interface nothing shows up in "System Settings". I don't even get an error or warning.
My guess, although nowhere described, would be that the configuration requires a portlet which the service builder isn't.
How do I get it to work?
thumbnail
Mohammed Yasin, modified 5 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts
Bernd S, modified 5 Years ago. Junior Member Posts: 59 Join Date: 3/31/15 Recent Posts
Unfortunately not, since I am not using a Liferay workspace.
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
It could still be the problem.
You can check for it by looking into the jar file. There should be a folder in there with an xml describing your configuration. If it isn't there, you hit that issue.
Please check your build.gradle for the following line:
classpath group: "com.liferay", name: "com.liferay.gradle.plugins", version: "<VERSION>"
I am not sure, what the problematic versions of Liferay were, I think, the relevant issue was introduced in June (I am not 100% sure about the month), just increase the version to the most current and try again.
https://mvnrepository.com/artifact/com.liferay/com.liferay.gradle.plugins
thumbnail
David H Nebinger, modified 5 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
I don't think this has anything to do w/ the liferay workspace.

Did you get farther down in the linked doco where it talks about the ExtendedObjectClassDefinition stuff? I think you may be missing a category and/or a scope necessary to treat the config as an instance-level setting...
Bernd S, modified 5 Years ago. Junior Member Posts: 59 Join Date: 3/31/15 Recent Posts
I don't even get that far. According to the documentation I should see the configuration after adding the interface and the entry in bnd.bnd.

Just tested with a normal MVC Portlet and there it works instantly with exactly the described configuration. My guess, that it only works with portlets, still stands.
Bernd S, modified 5 Years ago. Junior Member Posts: 59 Join Date: 3/31/15 Recent Posts
Ended up implementing a Java native solution (properties file + WatchService) since the "Liferay way" simply wasn't working inside service builder (worked inside a portlet with the same setup).