Commit 666059c0 authored by Misagh Moayyed's avatar Misagh Moayyed

working on external tomcat setup

parent e63fc60f
......@@ -12,3 +12,4 @@ build/
bin/
*.iml
*.log
apache-tomcat
......@@ -10,14 +10,14 @@ function copy() {
}
function help() {
echo "Usage: build.sh [copy|clean|package|run|debug|bootrun|gencert]"
echo "Usage: build.sh [copy|clean|package|run|debug|tomcat|gencert]"
echo " copy: Copy config from ./etc/cas/config to /etc/cas/config"
echo " clean: Clean Maven build directory"
echo " package: Clean and build CAS war"
echo " run: Build and run cas.war via Java (i.e. java -jar target/cas.war)"
echo " runalone: Build and run cas.war on its own as a standalone executable (target/cas.war)"
echo " debug: Run CAS.war and listen for Java debugger on port 5000"
echo " bootrun: Run with maven spring boot plugin"
echo " tomcat: Deploy the CAS web application to an external Apache Tomcat server"
echo " listviews: List all CAS views that ship with the web application and can be customized in the overlay"
echo " getview: Ask for a view name to be included in the overlay for customizations"
echo " gencert: Create keystore with SSL certificate in location where CAS looks by default"
......@@ -35,9 +35,19 @@ function package() {
# copy
}
function bootrun() {
function tomcat() {
shift
./mvnw clean package spring-boot:run -P bootiful -T 5 "$@"
export CATALINA_HOME=./apache-tomcat/
echo "Attempting to shutdown Apache Tomcat..."
./apache-tomcat/bin/shutdown.sh 2>/dev/null
ps -ef | grep tomcat
rm -Rf ./apache-tomcat
./mvnw clean package -P external -T 5 "$@" && cp target/cas.war apache-tomcat/webapps/
chmod +x ./apache-tomcat/bin/*.sh
./apache-tomcat/bin/startup.sh
tail -F ./apache-tomcat/logs/catalina.out
}
function debug() {
......@@ -92,7 +102,6 @@ function getview() {
fi
}
function gencert() {
if [[ ! -d /etc/cas ]] ; then
copy
......@@ -159,9 +168,9 @@ case "$1" in
shift
package "$@"
;;
"bootrun")
"tomcat")
shift
bootrun "$@"
tomcat "$@"
;;
"debug")
debug "$@"
......
......@@ -7,7 +7,7 @@
<artifactId>cas-overlay</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<build>
<plugins>
<plugin>
......@@ -79,7 +79,9 @@
<properties>
<cas.version>6.0.0-RC1-SNAPSHOT</cas.version>
<springboot.version>2.0.3.RELEASE</springboot.version>
<tomcat.version>9</tomcat.version>
<tomcat.fullversion>${tomcat.version}.0.10</tomcat.fullversion>
<!-- app.server could be -jetty, -undertow, -tomcat, or blank if you plan to provide appserver -->
<app.server>-tomcat</app.server>
<isExecutable>false</isExecutable>
......@@ -173,10 +175,11 @@
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<id>bootiful</id>
<id>external</id>
<properties>
<app.server>-tomcat</app.server>
<app.server></app.server>
<isExecutable>false</isExecutable>
<mainClass>${startClass}</mainClass>
</properties>
<dependencies>
<dependency>
......@@ -184,10 +187,51 @@
<artifactId>cas-server-webapp${app.server}</artifactId>
<version>${cas.version}</version>
<type>war</type>
<scope>runtime</scope>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>download-tomcat</id>
<phase>package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>http://www-eu.apache.org/dist/tomcat/tomcat-${tomcat.version}/v${tomcat.fullversion}/bin/apache-tomcat-${tomcat.fullversion}.zip</url>
<unpack>true</unpack>
<outputDirectory>${project.basedir}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>rename-file</id>
<phase>package</phase>
<goals>
<goal>rename</goal>
</goals>
<configuration>
<sourceFile>${project.basedir}/apache-tomcat-${tomcat.fullversion}</sourceFile>
<destinationFile>${project.basedir}/apache-tomcat</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment