Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAVEN-109 #79

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -17,6 +17,7 @@
import com.liferay.maven.plugins.util.CopyTask;
import com.liferay.maven.plugins.util.FileUtil;
import com.liferay.maven.plugins.util.GetterUtil;
import com.liferay.maven.plugins.util.SAXReaderUtil;
import com.liferay.maven.plugins.util.Validator;

import java.io.File;
Expand Down Expand Up @@ -50,6 +51,8 @@
import org.codehaus.plexus.archiver.UnArchiver;
import org.codehaus.plexus.archiver.manager.ArchiverManager;

import org.xml.sax.EntityResolver;

/**
* @author Mika Koivisto
*/
Expand All @@ -72,6 +75,8 @@ public void execute() throws MojoExecutionException {

initPortalProperties();

initUtils();

doExecute();
}
catch (Throwable t) {
Expand Down Expand Up @@ -474,6 +479,17 @@ protected void initPortalProperties() throws Exception {
}
}

protected void initUtils() throws Exception {
ClassLoader classLoader = getToolsClassLoader();

Class<?> clazz = classLoader.loadClass(
"com.liferay.portal.util.EntityResolver");

EntityResolver entityResolver = (EntityResolver)clazz.newInstance();

SAXReaderUtil.setEntityResolver(entityResolver);
}

protected boolean isLiferayProject() {
String packaging = project.getPackaging();

Expand Down
Expand Up @@ -19,6 +19,8 @@
import org.dom4j.Document;
import org.dom4j.io.SAXReader;

import org.xml.sax.EntityResolver;

/**
* @author Brian Wing Shun Chan
*/
Expand All @@ -27,7 +29,15 @@ public class SAXReaderUtil {
public static Document read(File file, boolean validate) throws Exception {
SAXReader saxReader = new SAXReader(validate);


saxReader.setEntityResolver(_entityResolver);

return saxReader.read(file);
}

public static void setEntityResolver(EntityResolver entityResolver) {
_entityResolver = entityResolver;
}

private static EntityResolver _entityResolver;
}
14 changes: 7 additions & 7 deletions pom.xml
Expand Up @@ -161,14 +161,14 @@
</profile>
</profiles>
<properties>
<liferay.version>6.2.10.1-ga1</liferay.version>
<liferay.version>6.2.0-ga1</liferay.version>
<maven.version>2.0.10</maven.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<liferay.repository.release.id>liferay-releases-ee</liferay.repository.release.id>
<liferay.repository.release.name>Liferay Releases EE</liferay.repository.release.name>
<liferay.repository.release.url>https://repository.liferay.com/nexus/content/repositories/liferay-releases-ee</liferay.repository.release.url>
<liferay.repository.snapshots.id>liferay-snapshots-ee</liferay.repository.snapshots.id>
<liferay.repository.snapshots.name>Liferay Snapshots EE</liferay.repository.snapshots.name>
<liferay.repository.snapshots.url>https://repository.liferay.com/nexus/content/repositories/liferay-snapshots-ee</liferay.repository.snapshots.url>
<liferay.repository.release.id>liferay-releases-ce</liferay.repository.release.id>
<liferay.repository.release.name>Liferay Releases CE</liferay.repository.release.name>
<liferay.repository.release.url>https://repository.liferay.com/nexus/content/repositories/liferay-releases-ce/</liferay.repository.release.url>
<liferay.repository.snapshots.id>liferay-snapshots-ce</liferay.repository.snapshots.id>
<liferay.repository.snapshots.name>Liferay Snapshots CE</liferay.repository.snapshots.name>
<liferay.repository.snapshots.url>https://repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/</liferay.repository.snapshots.url>
</properties>
</project>