| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| <!-- |
| Builds bundled and source distribution of Pluto, archiving it in zip, gzip and bzip2 files. |
| Prerequisites for this build includes an installed Java 5+ JDK, Maven 2.0+ and Ant 1.6+. |
| |
| Run the binary build using the command line: |
| ant -f dist-build.xml |
| |
| Or if you want to include the demo portlet WARs: |
| ant -f dist-build.xml -DincludeDemos=true |
| |
| If you want to package the TCK source & deliverables (warning: produces large files!): |
| ant -f dist-build.xml -DpackageTck=true |
| |
| If you want to retain the intermediate products (tomcat directory), add the noClean flag: |
| ant -f dist-build.xml -DincludeDemos=true -DnoClean=true |
| |
| If you want to just package an existing build without cleaning and recompiling first, |
| add the packageOnly flag: |
| ant -f dist-build.xml -DincludeDemos=true -DpackageOnly=true |
| |
| The bundled distribution is done in the following way: |
| 1. Downloads Tomcat from Apache and unzips it into a working directory. To this distribution, the |
| build: |
| a. Adds emptySessionPath="true" to server.xml. |
| b. Adds a pluto and tomcat users with pluto and manager roles to tomcat-users.xml. |
| 2. Runs 'mvn install' and 'mvn pluto:install' to create the Pluto driver and testsuite |
| and installs them into the Tomcat dist in the working directory. |
| 3. Archives the altered Tomcat dist with Pluto into a zip, gzip and bzip2 file. |
| |
| All built distributions end up in target/dist. |
| |
| After unarchiving the built distribution into a directory, invoke the startup script in the bin |
| directory and browse to: http://localhost:8080/pluto/portal/ |
| |
| Login as 'pluto' (password=pluto) to the portal. You will need to login again into the manager |
| application linked at the bottom of the Pluto Admin page in order to upload portlet application |
| war files to be able to deploy them to Pluto using the admin portlet. The 'tomcat' (password=tomcat) |
| user can also be used to deploy portlets. |
| --> |
| <project name="PlutoDistributions" default="bundle-dist"> |
| |
| <property name="tomcat.major.version" value="8" description="Major version of Tomcat to deploy Pluto war files."/> |
| <property name="tomcat.full.version" value="8.5.40" description="Full version of Tomcat to deploy Pluto war files."/> |
| |
| <xmlproperty file="pom.xml"/> <!-- picks up pluto build version from pom file --> |
| <property name="pluto.version" value="${project.version}" description="Version of Pluto to build"/> |
| <property name="portals.portlet-api.version" value="${project.properties.portals.portlet-api.version}" description="Version of the Portlet API"/> |
| |
| <property name="dist.basedir" value="target/dist" description="Base working directory"/> |
| <property name="base.name" value="apache-tomcat-${tomcat.full.version}"/> |
| <property name="dist.dir" value="${dist.basedir}/${base.name}"/> |
| <property name="tck.dir" value="portlet-tck_3.0"/> |
| <property name="pluto.name" value="pluto-${pluto.version}"/> |
| <property name="pluto.tck.name" value="pluto-${pluto.version}-tck"/> |
| <property name="pluto.dir" value="${dist.basedir}/${pluto.name}"/> |
| <property name="cache.dir" value="${user.home}/.m2/repository/org/apache/tomcat/dist" /> |
| <property name="download.file" value="${cache.dir}/${base.name}.tar.gz" /> |
| <property name="tar.file" value="${dist.basedir}/${base.name}.tar"/> |
| |
| <target name="bundle-dist" |
| depends="prepare-bundle-dist,run-maven-exclude-demos,run-maven-include-demos,run-pluto-maven-plugin" |
| description="Creates zip, gzip, and bzip2 distributions"> |
| <!-- Copy over jars needed to deploy custom portlets --> |
| <copy file="pluto-util/target/pluto-util-${pluto.version}.jar" todir="${dist.dir}/PlutoDomain"/> |
| |
| <antcall target="include-demos" /> |
| |
| <!-- Zip everything up --> |
| <zip destfile="${dist.basedir}/${pluto.name}-bundle.zip"> |
| <zipfileset prefix="${pluto.name}" dir="${dist.dir}" includes="**/*"/> |
| </zip> |
| |
| <antcall target="tar-nocompress"/> |
| |
| <gzip src="${dist.basedir}/${pluto.name}-bundle.tar" |
| destfile="${dist.basedir}/${pluto.name}-bundle.tar.gz"/> |
| |
| <bzip2 src="${dist.basedir}/${pluto.name}-bundle.tar" |
| destfile="${dist.basedir}/${pluto.name}-bundle.tar.bz2"/> |
| |
| <antcall target="package-portlet-api"/> |
| |
| <antcall target="package-tck"/> |
| |
| <antcall target="clean"/> |
| </target> |
| |
| <target name="package-portlet-api" if="packagePortletAPI"> |
| <copy file="portlet-api/target/portlet-api-${portals.portlet-api.version}.jar" todir="${dist.basedir}"/> |
| <copy file="portlet-api/target/portlet-api-${portals.portlet-api.version}-javadoc.jar" todir="${dist.basedir}"/> |
| <copy file="portlet-api/target/portlet-api-${portals.portlet-api.version}-sources.jar" todir="${dist.basedir}"/> |
| </target> |
| |
| <target name="package-tck" if="packageTck"> |
| <zip destfile="${dist.basedir}/${pluto.name}-tck.zip"> |
| <zipfileset prefix="${pluto.tck.name}" dir="${tck.dir}" includes="**/*"/> |
| </zip> |
| |
| <tar destfile="${dist.basedir}/${pluto.name}-tck.tar"> |
| <tarfileset prefix="${pluto.name}" dir="${tck.dir}" username="pluto" group="pluto"> |
| <include name="**/*"/> |
| </tarfileset> |
| </tar> |
| |
| <gzip src="${dist.basedir}/${pluto.name}-tck.tar" |
| destfile="${dist.basedir}/${pluto.name}-tck.tar.gz"/> |
| |
| <bzip2 src="${dist.basedir}/${pluto.name}-tck.tar" |
| destfile="${dist.basedir}/${pluto.name}-tck.tar.bz2"/> |
| |
| </target> |
| |
| <target name="include-demos" if="includeDemos"> |
| <copy file="demo/applicant-mvcbean-cdi-jsp-portlet/target/applicant-mvcbean-cdi-jsp-portlet.war" todir="${dist.dir}/webapps" /> |
| <copy file="demo/chat-room-demo-portlet/target/chat-room-demo-portlet.war" todir="${dist.dir}/webapps" /> |
| <copy file="demo/hub-demo-portlet/target/hub-demo-portlet.war" todir="${dist.dir}/webapps" /> |
| <copy file="demo/v3-annotated-demo-portlet/target/v3-annotated-demo-portlet.war" todir="${dist.dir}/webapps" /> |
| <copy file="demo/v3-demo-portlet/target/v3-demo-portlet.war" todir="${dist.dir}/webapps" /> |
| </target> |
| |
| <target name="tar-nocompress" description="Creates tar bundled distribution"> |
| <tar destfile="${dist.basedir}/${pluto.name}-bundle.tar"> |
| <tarfileset prefix="${pluto.name}" dir="${dist.dir}" mode="755" username="pluto" group="pluto"> |
| <include name="bin/*.sh"/> |
| </tarfileset> |
| <tarfileset prefix="${pluto.name}" dir="${dist.dir}" username="pluto" group="pluto"> |
| <include name="**/*"/> |
| <exclude name="bin/*.sh"/> |
| </tarfileset> |
| </tar> |
| </target> |
| |
| <!-- convenience to speed up the build --> |
| <target name="preclean" unless="packageOnly"> |
| <exec executable="mvn" vmlauncher="false" dir="${basedir}" failonerror="true"> |
| <arg line="clean:clean"/> |
| </exec> |
| </target> |
| |
| <target name="prepare-bundle-dist" depends="preclean"> |
| <delete dir="${dist.basedir}" failonerror="false"/> |
| <mkdir dir="${dist.basedir}"/> |
| <mkdir dir="${cache.dir}" /> |
| <get src="http://archive.apache.org/dist/tomcat/tomcat-${tomcat.major.version}/v${tomcat.full.version}/bin/${base.name}.tar.gz" |
| dest="${download.file}" skipexisting="true" /> |
| |
| <gunzip src="${download.file}" |
| dest="${dist.basedir}" |
| description="Creates tar from tar.gz tomcat dist" |
| /> |
| |
| <untar src="${tar.file}" |
| dest="${dist.basedir}" |
| description="Untars tomcat dist" |
| /> |
| |
| <!-- Copy over README --> |
| <copy file="README" todir="${dist.dir}"/> |
| |
| <!-- Copy over additional licenses from pluto and testsuite web app--> |
| <copy todir="${dist.dir}" flatten="true"> |
| <fileset dir="${basedir}/pluto-testsuite"> |
| <include name="src/main/webapp/META-INF/*-LICENSE"/> |
| </fileset> |
| </copy> |
| <copy todir="${dist.dir}" flatten="true"> |
| <fileset dir="${basedir}/pluto-portal"> |
| <include name="src/main/webapp/META-INF/*-LICENSE"/> |
| </fileset> |
| </copy> |
| |
| <!-- Add sessionCookiePath="/" to root Context in context.xml |
| (Tomcat 6.0.27+ replacement for emptySessionPath="true" attribute of Connector element in server.xml) --> |
| <replace file="${dist.dir}/conf/context.xml" |
| token="<Context>" |
| value="<Context sessionCookiePath="/">" |
| summary="true" |
| /> |
| |
| <replace file="${dist.dir}/conf/catalina.properties" |
| token="common.loader=" |
| value="common.loader="${catalina.home}/lib/weld-servlet-2.3.1.Final.jar"," |
| summary="true" |
| /> |
| |
| <concat append="true" |
| destfile="${dist.dir}/conf/catalina.properties">org.apache.catalina.STRICT_SERVLET_COMPLIANCE=true</concat> |
| |
| <!-- Add 'pluto' and 'tomcat' users to tomcat-users.xml --> |
| <replace file="${dist.dir}/conf/tomcat-users.xml" |
| token="</tomcat-users>" |
| value="<user name="tomcat" password="tomcat" roles="tomcat,pluto,manager-gui" />${line.separator}<user name="pluto" password="pluto" roles="pluto,manager-gui,tckuser" />${line.separator}</tomcat-users>" |
| summary="true" |
| /> |
| </target> |
| |
| <!-- Determine whether or not to include the demo portlets --> |
| <condition property="installDemos"> |
| <and> |
| <equals casesensitive="false" arg1="${includeDemos}" arg2="true"/> |
| <not> |
| <equals casesensitive="false" arg1="${packageOnly}" arg2="true"/> |
| </not> |
| </and> |
| </condition> |
| |
| <!-- Only do mvn install if 'packageOnly' is not set --> |
| <condition property="installNoDemos"> |
| <and> |
| <not> |
| <equals casesensitive="false" arg1="${includeDemos}" arg2="true"/> |
| </not> |
| <not> |
| <equals casesensitive="false" arg1="${packageOnly}" arg2="true"/> |
| </not> |
| </and> |
| </condition> |
| |
| <target name="run-maven-exclude-demos" if="installNoDemos" description="Runs the install goal and excludes the demos from pluto-portal-driver-config.xml"> |
| <exec executable="mvn" vmlauncher="false" dir="${basedir}" failonerror="true"> |
| <arg line="install -Pall,pluto,excludeDemos -DskipTests=true"/> |
| </exec> |
| </target> |
| |
| <target name="run-maven-include-demos" if="installDemos" description="Runs the install goal and includes the demos in pluto-portal-driver-config.xml"> |
| <exec executable="mvn" vmlauncher="false" dir="${basedir}" failonerror="true"> |
| <arg line="install -Pall,pluto -DskipTests=true"/> |
| </exec> |
| </target> |
| |
| <target name="run-pluto-maven-plugin" description="Runs the install goal for the pluto-maven-plugin"> |
| <exec executable="mvn" vmlauncher="false" dir="${basedir}" failonerror="true"> |
| <arg line="org.apache.portals.pluto:pluto-maven-plugin:${pluto.version}:install -DinstallDir=${basedir}/${dist.dir}"/> |
| </exec> |
| </target> |
| |
| <target name="clean" unless="noClean"> |
| <delete dir="${dist.dir}"/> |
| <delete file="${tar.file}"/> |
| </target> |
| |
| </project> |