Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Liferay IDE 3.5 - External properties file gets overridden (wiped out)
When you specify an external properties file to use, the file gets completly overridden and you lose your custom settings. The new external properties file just has the following...
I believe the problem is in the LiferayTomcatUtil.java class with the _setupExternalPropertiesFile method. The current code wipes out my settings.
Current code...
When I revert the code back to the following, it works.
Notice how the output stream is not created in the try statement as in the current code. When it is created in the try statement, it does not work.
# Last modified by Liferay IDE Wed Feb 20 09:38:31 MST 2019
include-and-override=[some location]\portal-ide.properties
I believe the problem is in the LiferayTomcatUtil.java class with the _setupExternalPropertiesFile method. The current code wipes out my settings.
Current code...
private static File _setupExternalPropertiesFile(File portalIdePropFile, String externalPropertiesPath) {
File retval = null;
File externalPropertiesFile = new File(externalPropertiesPath);
if (FileUtil.exists(externalPropertiesFile)) {
ExternalPropertiesConfiguration props = new ExternalPropertiesConfiguration();
try (InputStream newInputStream = Files.newInputStream(externalPropertiesFile.toPath());
OutputStream outputStream = Files.newOutputStream(externalPropertiesFile.toPath())) {
props.load(newInputStream);
props.setProperty("include-and-override", portalIdePropFile.getAbsolutePath());
props.setHeader("# Last modified by Liferay IDE " + new Date());
props.save(outputStream);
retval = externalPropertiesFile;
}
catch (Exception e) {
retval = null;
}
}
else {
retval = null;
}
return retval;
}
When I revert the code back to the following, it works.
private static File _setupExternalPropertiesFile(File portalIdePropFile, String externalPropertiesPath) {
File retval = null;
File externalPropertiesFile = new File(externalPropertiesPath);
if (FileUtil.exists(externalPropertiesFile)) {
ExternalPropertiesConfiguration props = new ExternalPropertiesConfiguration();
try (InputStream newInputStream = Files.newInputStream(externalPropertiesFile.toPath())) {
props.load(newInputStream);
props.setProperty("include-and-override", portalIdePropFile.getAbsolutePath());
props.setHeader("# Last modified by Liferay IDE " + new Date());
props.save(Files.newOutputStream(externalPropertiesFile.toPath()));
retval = externalPropertiesFile;
}
catch (Exception e) {
retval = null;
}
}
else {
retval = null;
}
return retval;
}
Notice how the output stream is not created in the try statement as in the current code. When it is created in the try statement, it does not work.
Cleaner code in the try catch block...
try {
props.load(externalPropertiesFile.getAbsolutePath());
props.setProperty("include-and-override", portalIdePropFile.getAbsolutePath());
props.setHeader("# Last modified by Liferay IDE (3.6.2-ga3) " + new Date());
props.save(externalPropertiesFile.getAbsolutePath());
retval = externalPropertiesFile;
}
catch (Exception e) {
retval = null;
}
Hey Gordon,
If you have the time, would you mind opening a ticket at issues.liferay.com and then updating this thread with a link to it? That way if someone else comes alogn later, they can follow the trail and see the status of the issue (and any dialogue from the Liferay team).
If you have the time, would you mind opening a ticket at issues.liferay.com and then updating this thread with a link to it? That way if someone else comes alogn later, they can follow the trail and see the status of the issue (and any dialogue from the Liferay team).
Hello Gordon,
Thanks for catching this problem. And thanks Andrew for prompt creating a ticket on issues.liferay.com.
I've created a ticket which will be fixed in next release.
Thanks for catching this problem. And thanks Andrew for prompt creating a ticket on issues.liferay.com.
I've created a ticket which will be fixed in next release.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™