Detailed usage information - marmots/marmots-opencms-maven-plugin GitHub Wiki

Requirements

  • clone this repository and mvn install
  • JLAN enabled opencms installation (works in any port, for Windows clients you can change default 1445 port)

Then

  1. Create the module in opencms Create the module in opencms Module information

  2. Create resource type(s) Create a resource type Resource type creation output Create a resource type Resource type creation output

  3. Publish and Export newly created module Export newly created module Module export output

  4. Unzip exported module to a file system folder Unzip exported module to a file system folder File system folder

  5. Open eclipse and create a new maven project New maven project Simple project, skip archetype selection Enter project information

  6. Create /src/main/opencms folder and copy all content from previous module unzip destination folder. This will be the project layout: project layout

(NOTE: to view module configuration file - .config - in eclipse you can rename it to module-config.xml, the plugin will rename this file when publishing or generating module package)

7.- Edit pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>org.marmots.opencms.samplesite</groupId>
	<artifactId>marmots-sample-site</artifactId>
	<version>0.0.1-SNAPSHOT</version>

	<name>marmots-sample-site</name>
	<description>marmots-sample-site</description>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.marmots.opencms</groupId>
			<artifactId>marmots-opencms-maven-plugin</artifactId>
			<version>0.0.1-SNAPSHOT</version>
			<type>maven-plugin</type>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.3</version>
				<configuration>
					<source>${java.version}</source>
					<target>${java.version}</target>
					<compilerArgument>-Xlint:all</compilerArgument>
					<showWarnings>true</showWarnings>
					<showDeprecation>true</showDeprecation>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>2.10</version>
				<executions>
					<execution>
						<id>copy-dependencies</id>
						<phase>package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/lib</outputDirectory>
							<overWriteReleases>false</overWriteReleases>
							<overWriteSnapshots>false</overWriteSnapshots>
							<overWriteIfNewer>true</overWriteIfNewer>
							<excludeTransitive>true</excludeTransitive>
							<excludeArtifactIds>marmots-opencms-maven-plugin</excludeArtifactIds>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.marmots.opencms</groupId>
				<artifactId>marmots-opencms-maven-plugin</artifactId>
				<version>0.0.1-SNAPSHOT</version>
				<executions>
					<execution>
						<id>publish</id>
						<phase>compile</phase>
						<goals>
							<goal>publish</goal>
						</goals>
						<configuration>
							<url>smb://Admin:admin@localhost:1446/OPENCMS/</url>
							<module>org.marmots.opencms.samplesite</module>
						</configuration>
					</execution>
					<execution>
						<id>module</id>
						<phase>package</phase>
						<goals>
							<goal>module</goal>
						</goals>
						<configuration>
							<module>org.marmots.opencms.samplesite</module>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>

		<pluginManagement>
			<plugins>
				<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.marmots.opencms
										</groupId>
										<artifactId>
											marmots-opencms-maven-plugin
										</artifactId>
										<versionRange>
											[0.0.1-SNAPSHOT,)
										</versionRange>
										<goals>
											<goal>module</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore></ignore>
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.marmots.opencms
										</groupId>
										<artifactId>
											marmots-opencms-maven-plugin
										</artifactId>
										<versionRange>
											[0.0.1-SNAPSHOT,)
										</versionRange>
										<goals>
											<goal>publish</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<execute>
											<runOnIncremental>true</runOnIncremental>
										</execute>
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
</project>

That's it:

  • eclipse m2 compile phase will trigger (automatically) publish goal: the plugin will copy all modified resources to opencms via JLAN url (smb://Admin:admin@localhost:1446/OPENCMS/)
  • maven install phase will trigger package goal: the plugin will create org.marmots.opencms.samplesite.zip
⚠️ **GitHub.com Fallback** ⚠️