Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit 135d0cd

Browse files
committed
MAVEN-18
These are the changes working for ext direct deploy.
1 parent 95278d2 commit 135d0cd

File tree

3 files changed

+145
-8
lines changed

3 files changed

+145
-8
lines changed

plugins/liferay-maven-plugin/src/main/java/com/liferay/maven/plugins/ExtBuilderMojo.java

+29-7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
package com.liferay.maven.plugins;
1616

17+
import com.liferay.portal.kernel.util.StringPool;
1718
import com.liferay.portal.tools.ExtInfoBuilder;
1819
import com.liferay.portal.util.FileImpl;
1920
import com.liferay.util.ant.CopyTask;
@@ -192,8 +193,8 @@ protected void copyLibraryDependencies(File libDir, Artifact artifact)
192193
for (Dependency dependency : dependencies) {
193194
String scope = dependency.getScope();
194195

195-
if (scope.equalsIgnoreCase("provided") ||
196-
scope.equalsIgnoreCase("test")) {
196+
if (scope != null && (scope.equalsIgnoreCase("provided") ||
197+
scope.equalsIgnoreCase("test"))) {
197198

198199
continue;
199200
}
@@ -206,8 +207,20 @@ protected void copyLibraryDependencies(File libDir, Artifact artifact)
206207

207208
Artifact libArtifact = resolveArtifact(dependency);
208209

209-
File libJarFile = new File(
210-
libDir, libArtifact.getArtifactId() + ".jar");
210+
File libJarFile = null;
211+
212+
if (addVersionAndClassifier) {
213+
libJarFile = new File(
214+
libDir, libArtifact.getArtifactId() +
215+
(libArtifact.getVersion() == null ? "" :
216+
StringPool.DASH + libArtifact.getVersion()) +
217+
(libArtifact.getClassifier() == null ? "" :
218+
StringPool.DASH + libArtifact.getClassifier()) +
219+
".jar");
220+
} else {
221+
libJarFile = new File(
222+
libDir, libArtifact.getArtifactId() + ".jar");
223+
}
211224

212225
_fileUtil.copyFile(libArtifact.getFile(), libJarFile);
213226
}
@@ -242,10 +255,10 @@ protected Dependency createDependency(
242255
}
243256

244257
protected Artifact resolveArtifact(Dependency dependency) throws Exception {
245-
Artifact artifact = artifactFactory.createArtifact(
258+
Artifact artifact = artifactFactory.createArtifactWithClassifier(
246259
dependency.getGroupId(), dependency.getArtifactId(),
247-
dependency.getVersion(), dependency.getClassifier(),
248-
dependency.getType());
260+
dependency.getVersion(), dependency.getType(), dependency.getClassifier());
261+
artifact.setScope(dependency.getScope());
249262

250263
artifactResolver.resolve(
251264
artifact, remoteArtifactRepositories, localArtifactRepository);
@@ -347,7 +360,16 @@ protected void unpack(
347360
private File sqlSourceDir;
348361

349362
/**
363+
<<<<<<< Updated upstream
350364
* @parameter default-value="${project.build.directory}/${project.build.finalName}"
365+
=======
366+
* @parameter default-value="false"
367+
*/
368+
private boolean addVersionAndClassifier;
369+
370+
/**
371+
* @parameter expression="${project.build.directory}/${project.build.finalName}"
372+
>>>>>>> Stashed changes
351373
* @required
352374
*/
353375
private File webappDir;

plugins/liferay-maven-plugin/src/main/java/com/liferay/maven/plugins/PluginDirectDeployerMojo.java

+111
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@
1818
import com.liferay.portal.cache.memory.MemoryPortalCacheManager;
1919
import com.liferay.portal.kernel.cache.MultiVMPoolUtil;
2020
import com.liferay.portal.kernel.util.PropsKeys;
21+
<<<<<<< Updated upstream
2122
import com.liferay.portal.kernel.util.FileUtil;
2223
import com.liferay.portal.tools.WebXMLBuilder;
24+
=======
25+
import com.liferay.portal.kernel.util.StringPool;
26+
import com.liferay.portal.tools.WebXMLBuilder;
27+
import com.liferay.portal.tools.deploy.ExtDeployer;
28+
>>>>>>> Stashed changes
2329
import com.liferay.portal.tools.deploy.HookDeployer;
2430
import com.liferay.portal.tools.deploy.LayoutTemplateDeployer;
2531
import com.liferay.portal.tools.deploy.PortletDeployer;
@@ -31,10 +37,17 @@
3137

3238
import java.io.File;
3339
import java.io.FileNotFoundException;
40+
import java.io.FilenameFilter;
41+
import java.io.IOException;
3442

3543
import java.util.ArrayList;
44+
import java.util.Arrays;
45+
import java.util.Collection;
3646
import java.util.List;
3747

48+
import org.apache.commons.io.FileUtils;
49+
import org.apache.commons.io.filefilter.FileFilterUtils;
50+
3851
import org.apache.maven.artifact.Artifact;
3952
import org.apache.maven.artifact.factory.ArtifactFactory;
4053
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -72,10 +85,18 @@ protected void doExecute() throws Exception {
7285
getLog().info("Directly deploying " + warFileName);
7386

7487
getLog().debug("appServerType: " + appServerType);
88+
// getLog().debug("appServerGlobalLibDir: " + appServerGlobalLibDir.getAbsolutePath());
89+
// getLog().debug("appServerLiferayRootDir: " + appServerLiferayRootDir.getAbsolutePath());
7590
getLog().debug("baseDir: " + baseDir);
91+
<<<<<<< Updated upstream
7692
getLog().debug("deployDir: " + appServerDeployDir.getAbsolutePath());
93+
=======
94+
getLog().debug("deployDir: " + deployDir.getAbsolutePath());
95+
getLog().debug("extDir: " + extDir.getAbsolutePath());
96+
>>>>>>> Stashed changes
7797
getLog().debug("jbossPrefix: " + jbossPrefix);
7898
getLog().debug("pluginType: " + pluginType);
99+
getLog().debug("projectName: " + projectName);
79100
getLog().debug("unpackWar: " + unpackWar);
80101

81102
preparePortalDependencies();
@@ -113,6 +134,7 @@ else if (pluginType.equals("web")) {
113134
}
114135

115136
protected void deployExt() throws Exception {
137+
<<<<<<< Updated upstream
116138
workDir.mkdirs();
117139

118140
UnArchiver unArchiver = archiverManager.getUnArchiver(warFile);
@@ -183,6 +205,69 @@ protected void deployExt() throws Exception {
183205
new File(workDir, "WEB-INF/ext-web/docroot/WEB-INF/classes"),
184206
appServerClassesPortalDir,
185207
"portal-*.properties,system-*.properties", null, true, true);
208+
=======
209+
210+
File appServerLiferayWebInfDir = new File(appServerLiferayRootDir +
211+
StringPool.FORWARD_SLASH + "WEB-INF");
212+
213+
File appServerLiferayWebInfLibDir = new File(appServerLiferayRootDir +
214+
StringPool.FORWARD_SLASH + "WEB-INF" +
215+
StringPool.FORWARD_SLASH + "lib");
216+
217+
FileUtils.copyDirectory(new File(extDir + "/WEB-INF/ext-lib/global"),
218+
appServerGlobalLibDir,
219+
FileFilterUtils.suffixFileFilter(".jar"));
220+
221+
FileUtils.copyDirectory(new File(extDir + "/WEB-INF/ext-lib/portal"),
222+
appServerLiferayWebInfLibDir,
223+
FileFilterUtils.suffixFileFilter(".jar"));
224+
225+
FileUtils.copyFile(new File(extDir + "/WEB-INF/ext-service/ext-service.jar"),
226+
new File(appServerGlobalLibDir, StringPool.FORWARD_SLASH +
227+
"ext-" + projectName + "-service.jar"));
228+
229+
FileUtils.copyFile(new File(extDir + "/WEB-INF/ext-impl/ext-impl.jar"),
230+
new File(appServerLiferayWebInfLibDir, StringPool.FORWARD_SLASH +
231+
"ext-" + projectName + "-impl.jar"));
232+
233+
FileUtils.copyFile(new File(extDir + "/WEB-INF/ext-impl/ext-impl.jar"),
234+
new File(appServerLiferayWebInfLibDir, StringPool.FORWARD_SLASH +
235+
"ext-" + projectName + "-impl.jar"));
236+
237+
FileUtils.copyFile(new File(extDir + "/WEB-INF/ext-util-bridges/ext-util-bridges.jar"),
238+
new File(appServerLiferayWebInfLibDir, StringPool.FORWARD_SLASH +
239+
"ext-" + projectName + "-util-bridges.jar"));
240+
241+
FileUtils.copyFile(new File(extDir + "/WEB-INF/ext-util-java/ext-util-java.jar"),
242+
new File(appServerLiferayWebInfLibDir, StringPool.FORWARD_SLASH +
243+
"ext-" + projectName + "-util-java.jar"));
244+
245+
FileUtils.copyFile(new File(extDir + "/WEB-INF/ext-util-taglib/ext-util-taglib.jar"),
246+
new File(appServerLiferayWebInfLibDir, StringPool.FORWARD_SLASH +
247+
"ext-" + projectName + "-util-taglib.jar"));
248+
249+
File extWebWorkDir = new File(extDir + "/WEB-INF/ext-web/docroot");
250+
251+
FileUtils.copyDirectory(extWebWorkDir, appServerLiferayRootDir,
252+
FileFilterUtils.andFileFilter(FileFilterUtils.trueFileFilter(),
253+
FileFilterUtils.notFileFilter(
254+
FileFilterUtils.nameFileFilter("web.xml"))));
255+
256+
WebXMLBuilder webXMLBuilder = new WebXMLBuilder(
257+
appServerLiferayWebInfDir + "/web.xml",
258+
extDir + "/WEB-INF/ext-web/docroot/WEB-INF/web.xml",
259+
appServerLiferayRootDir + "/WEB-INF/web.xml.merged");
260+
261+
FileUtils.copyFile(new File(appServerLiferayRootDir + "/WEB-INF/web.xml.merged"),
262+
new File(appServerLiferayWebInfDir + "/web.xml"));
263+
264+
FileUtils.deleteQuietly(new File(appServerLiferayRootDir + "/WEB-INF/web.xml.merged"));
265+
266+
FileUtils.copyFile(new File(extDir + "/WEB-INF/ext-" + projectName + ".xml"),
267+
new File(appServerLiferayWebInfDir, StringPool.FORWARD_SLASH +
268+
"ext-" + projectName + ".xml"));
269+
270+
>>>>>>> Stashed changes
186271
}
187272

188273
protected void deployHook() throws Exception {
@@ -357,6 +442,16 @@ protected void preparePortalDependencies() throws Exception {
357442
*/
358443
private String appServerType;
359444

445+
/**
446+
* @parameter default-value="" expression="${appServerGlobalLibDir}"
447+
*/
448+
private File appServerGlobalLibDir;
449+
450+
/**
451+
* @parameter default-value="" expression="${appServerLiferayRootDir}"
452+
*/
453+
private File appServerLiferayRootDir;
454+
360455
/**
361456
* @component
362457
*/
@@ -392,7 +487,17 @@ protected void preparePortalDependencies() throws Exception {
392487
private File deployDir;
393488

394489
/**
490+
<<<<<<< Updated upstream
395491
* @parameter expression="${jbossPrefix}"
492+
=======
493+
* @parameter expression="${project.build.directory}/${project.build.finalName}"
494+
* @required
495+
*/
496+
private File extDir;
497+
498+
/**
499+
* @parameter default-value="" expression="${jbossPrefix}"
500+
>>>>>>> Stashed changes
396501
*/
397502
private String jbossPrefix;
398503

@@ -421,6 +526,12 @@ protected void preparePortalDependencies() throws Exception {
421526
*/
422527
private String pluginType;
423528

529+
/**
530+
* @parameter expression="${project.build.finalName}"
531+
* @required
532+
*/
533+
private String projectName;
534+
424535
/**
425536
* @parameter expression="${project.remoteArtifactRepositories}"
426537
* @readonly

pom.xml

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<artifactId>maven-support</artifactId>
77
<packaging>pom</packaging>
88
<name>Liferay Maven 2 Support</name>
9-
<version>6.2.0-SNAPSHOT</version>
9+
<version>6.1.10</version>
1010
<description>Parent project to support Maven 2 subprojects.</description>
1111
<url>http://www.liferay.com</url>
1212
<developers>
@@ -137,7 +137,11 @@
137137
</profile>
138138
</profiles>
139139
<properties>
140+
<<<<<<< Updated upstream
140141
<liferay.version>6.2.0-SNAPSHOT</liferay.version>
142+
=======
143+
<liferay.version>6.1.10</liferay.version>
144+
>>>>>>> Stashed changes
141145
<maven.version>2.0.10</maven.version>
142146
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
143147
<liferay.repository.release.id>sonatype-staging</liferay.repository.release.id>

0 commit comments

Comments
 (0)