NIHVIVO-56 Restructure the build script: get rid of cruft, make the product build an extension of the core build.

This commit is contained in:
jeb228 2010-02-21 18:45:18 +00:00
parent 609b18b940
commit 03ab54f1eb
7 changed files with 476 additions and 375 deletions

View file

@ -1,324 +1,284 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ --> <!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<!-- <!DOCTYPE project PUBLIC "-//ANT//DTD project//EN" "ant16.dtd" > this doesn't seem to work well. --> <!-- ======================================================================
Build script for the Vitro core webapp.
<project name="vivoWebApp" default="test" basedir="../"> This can be used on its own, or included into a Product build script.
====================================================================== -->
<!-- Load user property definition overrides --> <project name="vitroCore" default="describe">
<property file="./config/globalbuild.properties"/>
<!-- defined in globalbuild.properties --> <!-- - - - - - - - - - - - - - - - - -
<!-- <property name="webapp.dir" value="./webapp"/> --> properties
<!-- <property name="webapp.build" value="${webapp.dir}/.build"/> --> - - - - - - - - - - - - - - - - - -->
<!--
The build directory is located under the directory with the top-level
script, so if called from a Product build script, the build directory
will be in the Product directory.
-->
<property name="build.dir" location=".build" />
<!-- Property Definitions --> <!--
<property name="app.name" value="vitro-webapp"/> The webapp directory is based on this script, regardless of whether we
<property name="app.version" value="3.0"/> run this script alone, or call it from a Product build script.
-->
<dirname property="vitroCore.basedir" file="${ant.file.vitroCore}" />
<property name="webapp.dir" location="${vitroCore.basedir}" />
<!-- default lucene index dir:: --> <!--
<property name="luceneIndexDir" value="/usr/local/lucene/vitroAntdefault"/> The log file names will be prefixed with the project name, if this is
called from a Product build script.
-->
<condition property="logfile.prefix" value="">
<equals arg1="${ant.file.vitroCore}" arg2="${ant.file}" />
</condition>
<property name="logfile.prefix" value="${ant.project.name}."/>
<!-- defined in globalbuild.properties -->
<property name="source.dir" value="${source.home}"/>
<!-- The clones/build.xml file modifies this default upload directory, now used for images -->
<property name="uploadDir" value="${source.dir}/webapp/web" />
<property name="compile.debug" value="true"/> <!-- - - - - - - - - - - - - - - - - -
<property name="compile.deprecation" value="true" /> paths: for compiling and running
<property name="compile.optimize" value="true" /> - - - - - - - - - - - - - - - - - -->
<path id="compile.classpath">
<property name="dist.home" value="${webapp.dir}/dist"/> <fileset dir="${webapp.dir}/lib">
<include name="**/*.jar" />
<!-- directory for local modifications --> </fileset>
<property name="modDir" value="modifications"/>
<property name="axis.port" value="8080"/>
<property name="axis.server" value="localhost"/>
<!-- ==================== Compilation Classpath =========================== -->
<path id="webapp-compile.classpath">
<!-- Include all JAR files that will be included in /WEB-INF/lib -->
<fileset dir="webapp/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- ==================== Runtime Classpath =========================== -->
<path id="webapp-run.classpath">
<!-- some other jars we need -->
<!-- build dir -->
<pathelement path="${webapp.build}"/>
</path> </path>
<!-- =================== Axis Classpath ============================== --> <path id="test.compile.classpath">
<!-- need to include the classes directory so that axis can <pathelement location="${build.dir}/war/WEB-INF/classes" />
find the necessary compiled classes --> <path refid="compile.classpath" />
<path id="axis.classpath"> </path>
<pathelement path="${webapp.build}/WEB-INF/classes"/>
<fileset dir="webapp/lib">
<include name="**/*.jar" />
</fileset>
</path>
<!-- ================== set up the ant axis tasks ================ -->
<taskdef resource="axis-tasks.properties" classpathref="axis.classpath" />
<!-- ==================== All Target ====================================== --> <path id="test.run.classpath">
<!-- The "all" target is a shortcut for running the "clean" target followed <!--
by the "compile" target, to force a complete recompile. --> To get the data files and the correct log4j.properties,
<target name="all" depends="clean,compile" description="Clean build and dist, then compile"/> this comes before the classes directory
<!-- ==================== Clean Target ==================================== --> -->
<!-- The "clean" target deletes any previous "build" and "dist" directory, <pathelement location="${webapp.dir}/test" />
so that you can be ensured the application can be built from scratch.
do not delete the ${deploy.home}/images directory !!! that's where images <pathelement location="${build.dir}/testclasses" />
are uploaded to--> <path refid="test.compile.classpath" />
<target name="clean" description="Delete old build and dist directories"> </path>
<delete failonerror="false" dir="${webapp.build}"/>
<!-- =================================
target: describe
================================= -->
<target name="describe" description="--> The default target.">
<echo>
all - Runs "clean", then "deploy".
clean - Delete all artifacts so the next build will be from scratch.
compile - Compile the Java source files.
test - Compile and run the JUnit tests.
war - Assemble everything into a deployable WAR file.
deploy - Deploy the application directly into the Tomcat webapps directory.
</echo>
</target> </target>
<!-- ==================== Compile Target ================================== --> <!-- =================================
<!-- target: all
The "compile" target transforms source files (from your "src" directory) ================================= -->
into object files in the appropriate location in the build directory. <target name="all" depends="clean, deploy" description="Run 'clean', then 'deploy'" />
This example assumes that you will be including your classes in an
unpacked directory hierarchy under "/WEB-INF/classes". <!-- =================================
--> target: clean
<target name="compile" depends="prepare" description="Compile Java sources"> ================================= -->
<!-- deletes all files that depend on changes .java files --> <target name="clean" description="--> Delete all artifacts.">
<depend srcdir="${webapp.dir}/src" <delete dir="${build.dir}" />
destdir="${webapp.build}/WEB-INF/classes" </target>
closure="false"
cache=".depcache"> <!-- - - - - - - - - - - - - - - - - -
<classpath refid="webapp-compile.classpath"/> target: properties
</depend> - - - - - - - - - - - - - - - - - -->
<target name="properties">
<!--
If calling from a Product build script, then this property
already points to the deploy.properties file of the Product.
-->
<property name="deploy.properties.file" location="config/deploy.properties" />
<fail message="You must create a &quot;${deploy.properties.file}&quot; file.">
<condition>
<not>
<available file="${deploy.properties.file}" />
</not>
</condition>
</fail>
<property file="${deploy.properties.file}" />
<fail unless="tomcat.home"
message="${deploy.properties.file} must contain a value for tomcat.home" />
<fail unless="webapp.name"
message="${deploy.properties.file} must contain a value for webapp.name" />
<fail unless="upload.directory"
message="${deploy.properties.file} must contain a value for upload.directory" />
<fail unless="LuceneSetup.indexDir"
message="${deploy.properties.file} must contain a value for LuceneSetup.indexDir" />
<fail unless="Vitro.defaultNamespace"
message="${deploy.properties.file} must contain a value for Vitro.defaultNamespace" />
<fail unless="Vitro.smtpHost"
message="${deploy.properties.file} must contain a value for Vitro.smtpHost (may be empty)" />
<fail unless="VitroConnection.DataSource.url"
message="${deploy.properties.file} must contain a value for VitroConnection.DataSource.url" />
<fail unless="VitroConnection.DataSource.username"
message="${deploy.properties.file} must contain a value for VitroConnection.DataSource.username" />
<fail unless="VitroConnection.DataSource.password"
message="${deploy.properties.file} must contain a value for VitroConnection.DataSource.password" />
<fail unless="initialAdminUser"
message="${deploy.properties.file} must contain a value for initialAdminUser" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: prepare
- - - - - - - - - - - - - - - - - -->
<target name="prepare" depends="properties">
<mkdir dir="${build.dir}" />
<mkdir dir="${build.dir}/war/WEB-INF/classes" />
<mkdir dir="${build.dir}/testclasses" />
</target>
<!-- =================================
target: compile
================================= -->
<target name="compile" depends="prepare" description="Compile Java sources">
<!-- deletes all files that depend on changed .java files -->
<depend srcdir="${webapp.dir}/src"
destdir="${build.dir}/war/WEB-INF/classes"
closure="false"
cache="${build.dir}/.depcache">
<classpath refid="compile.classpath" />
</depend>
<echo>Compile webapp</echo>
<javac srcdir="${webapp.dir}/src" <javac srcdir="${webapp.dir}/src"
destdir="${webapp.build}/WEB-INF/classes" destdir="${build.dir}/war/WEB-INF/classes"
debug="${compile.debug}" debug="true"
deprecation="${compile.deprecation}" deprecation="true"
optimize="${compile.optimize}" optimize="true"
source="1.5"> source="1.5">
<classpath refid="webapp-compile.classpath"/> <classpath refid="compile.classpath" />
<!-- <compilerarg value="-Xlint:unchecked"/> --> </javac>
</target>
<!-- =================================
target: test
================================= -->
<target name="test" depends="compile" description="Run JUnit tests">
<javac srcdir="${webapp.dir}/test"
destdir="${build.dir}/testclasses"
debug="true"
deprecation="true"
optimize="false"
source="1.5">
<classpath refid="test.compile.classpath" />
</javac> </javac>
<echo>Compile unit tests</echo> <java classname="edu.cornell.mannlib.vitro.testing.VitroTestRunner"
<javac srcdir="${webapp.dir}/test" fork="yes"
destdir="${webapp.build}/WEB-INF/classes" failonerror="true">
debug="yes" <classpath refid="test.run.classpath" />
source="1.5">
<classpath refid="webapp-compile.classpath"/>
</javac>
</target>
<!-- ==================== Test Target ================================== -->
<!--
The "test" target runs JUnit tests against the compiled classes.
-->
<target name="test" depends="prepare,compile" description="Run JUnit tests" unless="skiptests">
<java classname="edu.cornell.mannlib.vitro.testing.VitroTestRunner" fork="yes" failonerror="true">
<classpath>
<!-- The classes and their supporting JARs -->
<pathelement location="${webapp.build}/WEB-INF/classes" />
<path refid="webapp-compile.classpath" />
<!-- Test data files are stored with the test source -->
<pathelement location="${webapp.dir}/test" />
</classpath>
<arg file="${webapp.dir}/test" /> <arg file="${webapp.dir}/test" />
<arg value="${testlevel}" /> <arg value="${testlevel}" />
</java> </java>
</target> </target>
<!-- ============================== Copy Etc ============================== --> <!-- - - - - - - - - - - - - - - - - -
<!-- There are configuration files under dream/etc that need to go in different --> target: copyEtc
<!-- places in the build. This target copies them to the correct places. --> - - - - - - - - - - - - - - - - - -->
<target name="copyEtc" <target name="copyEtc" depends="test">
description="copies the files from the dream/etc dir to correct places in build"> <copy todir="${build.dir}/war">
<echo> ${tomcat.home}</echo> <fileset dir="${webapp.dir}/web">
<copy todir="${webapp.build}/WEB-INF"> <!--
<fileset file="${webapp.dir}/config/web.xml"/> If a product doesn't want the core themes, it can
<fileset file="${webapp.dir}/config/dwr.xml"/> set this property and they will be skipped.
</copy> -->
<exclude name="themes/**/*" if="skip.core.themes" />
</fileset>
</copy>
<!-- copy the default log4j config and then copy the override if it exists --> <copy todir="${build.dir}/war/WEB-INF">
<copy file="${webapp.dir}/config/default.log4j.properties" <fileset file="${webapp.dir}/config/web.xml" />
tofile="${webapp.build}/WEB-INF/classes/log4j.properties" <fileset file="${webapp.dir}/config/dwr.xml" />
filtering="true"> </copy>
<filterchain><expandproperties/></filterchain>
</copy>
<copy file="${webapp.dir}/config/debugging.log4j.properties"
tofile="${webapp.build}/WEB-INF/classes/log4j.properties"
filtering="true"
failonerror="false">
<filterchain><expandproperties/></filterchain>
</copy>
<copy file="${webapp.dir}/config/default.log4j.properties"
tofile="${build.dir}/war/WEB-INF/classes/log4j.properties"
filtering="true">
<filterchain>
<expandproperties />
</filterchain>
</copy>
<!-- copy properties files --> <!-- TODO: Have the Jena code read the userId directly from the deploy.properties -->
<copy todir="${webapp.build}/WEB-INF/classes"> <copy file="${vitroCore.basedir}/ontologies/auth/example.vitroUsers.owl"
<fileset dir="${webapp.dir}/config" includes="deploy.properties" /> tofile="${build.dir}/war/WEB-INF/ontologies/auth/vitroUsers.owl"
</copy> filtering="true">
<filterchain>
<expandproperties />
</filterchain>
</copy>
<!-- TODO: Have the Jena code read the userId directly from the deploy.properties -->
<copy todir="${webapp.build}/WEB-INF/tlds"> <copy todir="${build.dir}/war/WEB-INF/classes">
<fileset dir="${webapp.dir}/config/tlds" includes="**/*" excludes="*.LCK"/></copy> <fileset file="${deploy.properties.file}" />
</copy>
<!-- copy the webservices files --> <copy todir="${build.dir}/war/WEB-INF/tlds">
<copy todir="${webapp.build}/WEB-INF/lib"> <fileset dir="${webapp.dir}/config/tlds" includes="**/*" excludes="*.LCK" />
<fileset dir="${ws.lib}" </copy>
includes="**/*"
excludes="*.LCK"/>
</copy>
<copy todir="${webapp.build}">
<fileset dir="${ws.dir}/additions"
includes="**/*"
excludes=".svn"/>
</copy>
<!-- copy the ontology files --> <!-- TODO Get rid of these webservices files -->
<copy todir="${webapp.build}/WEB-INF/ontologies"> <copy todir="${build.dir}/war/WEB-INF/lib">
<fileset dir="${webapp.dir}/ontologies"/> <fileset dir="${vitroCore.basedir}/../services/lib" includes="**/*" excludes="*.LCK" />
</copy> </copy>
<copy todir="${build.dir}/war">
<fileset dir="${vitroCore.basedir}/../services/additions" includes="**/*" />
</copy>
<!-- TODO Get rid of these webservices files -->
<!-- copy the model files --> <!-- TODO: These aren't needed in the core -->
<copy todir="${webapp.build}/WEB-INF/submodels" failonerror="false"> <copy todir="${build.dir}/war/WEB-INF/ontologies">
<fileset dir="${webapp.dir}/model/submodels"/> <fileset dir="${webapp.dir}/ontologies" />
</copy> </copy>
<copy todir="${build.dir}/war/WEB-INF/submodels" failonerror="false">
<fileset dir="${webapp.dir}/model/submodels" />
</copy>
<copy todir="${build.dir}/war/WEB-INF/init-data" failonerror="false">
<fileset dir="${webapp.dir}/model/init-data" />
</copy>
<!-- TODO: These aren't needed in the core -->
<!-- copy the init-data files --> <!-- xml files from src tree -->
<copy todir="${webapp.build}/WEB-INF/init-data" failonerror="false"> <copy todir="${build.dir}/war/WEB-INF/classes">
<fileset dir="${webapp.dir}/model/init-data"/> <fileset dir="${webapp.dir}/src" includes="**/*.xml" />
</copy> </copy>
<!-- xml files from src tree --> <copy todir="${build.dir}/war/WEB-INF/lib">
<copy todir="${webapp.build}/WEB-INF/classes"> <fileset dir="${webapp.dir}/lib">
<fileset dir="${webapp.dir}/src" includes="**/*.xml" excludes="*.svn"/> <!-- these are already in Tomcat: we shouldn't conflict. -->
</copy> <exclude name="jsp-api.jar" />
<exclude name="servlet-api.jar" />
</fileset>
</copy>
<copy todir="${webapp.build}/WEB-INF/lib"> <copy file="${webapp.dir}/context.xml" tofile="${build.dir}/war/META-INF/context.xml" />
<fileset dir="${webapp.lib}"> </target>
<!-- these are already in Tomcat: we shouldn't conflict. -->
<exclude name="jsp-api.jar"/>
<exclude name="servlet-api.jar"/>
</fileset>
</copy>
<copy file="${webapp.dir}/context.xml" <!-- =================================
tofile="${webapp.build}/META-INF/context.xml" /> target: deploy
</target> ================================= -->
<target name="deploy" depends="copyEtc" description="Deploy to Tomcat">
<property name="webapp.deploy.home" value="${tomcat.home}/webapps/${webapp.name}" />
<!-- ==================== Local Modifications ============================ --> <mkdir dir="${webapp.deploy.home}" />
<!-- The localMods target will copy local modifications into the build directory
so that a user can who is not using the clone system can have a way to
apply simple chages to the deployed web application. In many cases
there will be no modifications directory so this will do nothing. -->
<target name="localMods" depends="compile,test,copyEtc"
description="Adds local modifications to build">
<copy todir="${webapp.build}" overwrite="true" preservelastmodified="true" failonerror="false">
<fileset dir="${modDir}" />
</copy>
</target>
<!-- ==================== Deploy Target =================================== -->
<!--
The "deploy" target copies the contents of the build directory into a
location required by our servlet container, and picks up any external
dependencies along the way. After restarting the servlet container, you
can now test your web application. -->
<target name="deploy" depends="compile,test,copyEtc, localMods"
description="Deploy application to servlet container">
<!-- Copy the contents of the build directory -->
<mkdir dir="${webapp.deploy.home}"/>
<copy todir="${webapp.deploy.home}"> <copy todir="${webapp.deploy.home}">
<fileset dir="${webapp.build}"/> <fileset dir="${build.dir}/war" />
</copy> </copy>
</target> </target>
<!-- ==================== Jar Target ==================== -->
<target name="jar" depends="compile,test" description="Makes a jar file">
<jar jarfile="${webapp.dir.jar}" basedir="${webapp.build}/WEB-INF/classes"/>
</target>
<!-- ==================== Javadoc Target ================================== -->
<!--
The "javadoc" target creates Javadoc API documentation for the Java
classes included in your application. Normally, this is only required
when preparing a distribution release, but is available as a separate
target in case the developer wants to create Javadocs independently.
-->
<target name="javadoc" depends="compile" description="Create Javadoc API documentation">
<mkdir dir="${dist.home}/docs"/>
<javadoc sourcepath="src" classpathref="compile.classpath" destdir="${dist.home}/docs"
packagenames="*"/>
</target>
<!-- ==================== Prepare Target ================================== -->
<!--
The "prepare" target is used to create the "build" destination directory,
and copy the static contents of your web application to it.
Normally, this task is executed indirectly when needed. -->
<target name="prepare">
<!-- Create build directory and copy static content -->
<mkdir dir="${webapp.build}"/>
<mkdir dir="${webapp.build}/WEB-INF/classes"/>
<mkdir dir="${webapp.build}/WEB-INF/classes/properties"/>
<mkdir dir="${webapp.build}/WEB-INF/tlds"/>
<!--mkdir dir="${webapp.build}/jsp"/-->
<copy todir="${webapp.build}">
<fileset dir="${webapp.dir}/web"/>
</copy>
</target>
<!-- ==================== setupWs task ==================== -->
<target name="setupWs"
description="invoke axis admin to deploy and expose VitroWs">
<!-- Notice that this can be run from the command line too:
$ java org.apache.axis.client.AdminClient \
-lhttp://localhost:8080/vivo/services/AdminService deploy.wsdd -->
<axis-admin
port="${axis.port}"
hostname="${axis.server}"
failonerror="true"
servletpath="${webapp.name}/services/AdminService"
debug="true"
xmlfile="${webapp.dir}/config/VitroWs3.wsdd" />
</target>
<!-- ==================== axis prepare Target ======================== -->
<!--
The "axis" target is used to fill the "build" directory with files needed
for axis web services.
Normally, this task is executed indirectly when needed. -->
<target name="axisPrepare">
<copy todir="${webapp.build}/WEB-INF/classes">
<fileset dir="${webapp.dir}/config/axisproperties"
includes="**/*"
excludes=".svn"/>
</copy>
<copy file="${webapp.dir}/config/VitroWs3.wsdd"
todir="${webapp.build}/WEB-INF" />
</target>
<!-- =================== Create modifications directory ============== -->
<target name="prepareModDir"
description="create a directory structure to hold
local modifications"
depends="compile,test,copyEtc">
<mkdir dir="${modDir}"/>
<copy todir="${modDir}" >
<fileset dir="${webapp.build}">
<type type="dir"/>
<exclude name="WEB-INF/classes/"/>
<exclude name="jenaIngest"/>
<exclude name="src"/>
</fileset>
</copy>
</target>
</project> </project>

View file

@ -1,68 +0,0 @@
LuceneSetup.indexDir=${luceneIndexDir}
# The default.log4j.properties file will only get used if there is no
# debugging.log4j.properties file in the directory otherwise, the debugging.log4j.properties will
# be deployed and used.
# If you want to have a logging config for debugging
# and testing copy the default.log4j.properties file to debugging.log4j.properties,
# make your modifications and deploy. debugging.log4j.properties
# will be used instead of the default.log4j.properties file.
# levels: <-- more messages ALL DEBUG INFO WARN ERROR FATAL OFF fewer messages -->
log4j.rootLogger=WARN, AllAppender
log4j.appender.AllAppender=org.apache.log4j.RollingFileAppender
log4j.appender.AllAppender.File= ${tomcat.home}/logs/${clone}.all.log
log4j.appender.AllAppender.MaxFileSize=10MB
log4j.appender.AllAppender.MaxBackupIndex=10
log4j.appender.AllAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.AllAppender.layout.ConversionPattern=%p %t %c - %m%n
log4j.logger.org.apache.catalina=INFO, AllAppender
log4j.logger.org.diretwebremoting=ERROR, AllAppender
#log4j.logger.edu.cornell.mannlib.vitro.webapp.auth=INFO, AllAppender
#### setup a debugging logger
log4j.appender.DebuggingAppender=org.apache.log4j.FileAppender
log4j.appender.DebuggingAppender.File=${tomcat.home}/logs/${clone}.debugging.log
log4j.appender.DebuggingAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.DebuggingAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n
#log4j.logger.edu.cornell.mannlib.vitro.webapp=DEBUG, DebuggingAppender
#log4j.logger.edu.cornell.mannlib.vitro.webapp.auth=DEBUG, DebuggingAppender
#log4j.logger.edu.cornell.mannlib.vitro.webapp.dao.jena=DEBUG, DebuggingAppender
#### setup a debugging logger for the JSPs
#JSPs need to have a line like:
#<% org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("edu.cornell.mannlib.vitro.webapp.jsp.SOMEIDFORYOURJSP"); %>
log4j.appender.JspAppender=org.apache.log4j.FileAppender
log4j.appender.JspAppender.File=${tomcat.home}/logs/${clone}.jsp.log
log4j.appender.JspAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.JspAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n
log4j.logger.edu.cornell.mannlib.vitro.webapp.jsp=INFO, JspAppender
#log4j.logger.edu.cornell.mannlib.vitro.webapp.jsp.edit=DEBUG, JspAppender
#### setup a pellet logger
log4j.appender.PelletAppender=org.apache.log4j.FileAppender
log4j.appender.PelletAppender.File=${tomcat.home}/logs/${clone}.pellet.log
log4j.appender.PelletAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.PelletAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n
log4j.logger.org.mindswap=WARN, PelletAppender
#### setup a jena logger
log4j.appender.JenaAppender=org.apache.log4j.FileAppender
log4j.appender.JenaAppender.File=${tomcat.home}/logs/${clone}.jena.log
log4j.appender.JenaAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.JenaAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n
log4j.logger.com.hp.hpl=WARN, JenaAppender
# documentation for this file can be found here:
# http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PropertyConfigurator.html#doConfigure(java.lang.String,%20org.apache.log4j.spi.LoggerRepository)

View file

@ -1,5 +1,3 @@
LuceneSetup.indexDir=${luceneIndexDir}
# The default.log4j.properties file will only get used if there is no # The default.log4j.properties file will only get used if there is no
# debugging.log4j.properties file in the directory otherwise, the debugging.log4j.properties will # debugging.log4j.properties file in the directory otherwise, the debugging.log4j.properties will
# be deployed and used. # be deployed and used.
@ -13,7 +11,7 @@ LuceneSetup.indexDir=${luceneIndexDir}
log4j.rootLogger=WARN, AllAppender log4j.rootLogger=WARN, AllAppender
log4j.appender.AllAppender=org.apache.log4j.RollingFileAppender log4j.appender.AllAppender=org.apache.log4j.RollingFileAppender
log4j.appender.AllAppender.File= ${tomcat.home}/logs/vitro.all.log log4j.appender.AllAppender.File= ${tomcat.home}/logs/${logfile.prefix}vitro.all.log
log4j.appender.AllAppender.MaxFileSize=10MB log4j.appender.AllAppender.MaxFileSize=10MB
log4j.appender.AllAppender.MaxBackupIndex=10 log4j.appender.AllAppender.MaxBackupIndex=10
log4j.appender.AllAppender.layout=org.apache.log4j.PatternLayout log4j.appender.AllAppender.layout=org.apache.log4j.PatternLayout
@ -27,7 +25,7 @@ log4j.logger.edu.cornell.mannlib.vitro.webapp.ConfigurationProperties=INFO
#### setup a debugging logger #### setup a debugging logger
log4j.appender.DebuggingAppender=org.apache.log4j.FileAppender log4j.appender.DebuggingAppender=org.apache.log4j.FileAppender
log4j.appender.DebuggingAppender.File=${tomcat.home}/logs/vitro.debugging.log log4j.appender.DebuggingAppender.File=${tomcat.home}/logs/${logfile.prefix}vitro.debugging.log
log4j.appender.DebuggingAppender.layout=org.apache.log4j.PatternLayout log4j.appender.DebuggingAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.DebuggingAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n log4j.appender.DebuggingAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n
@ -40,7 +38,7 @@ log4j.appender.DebuggingAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} -
#JSPs need to have a line like: #JSPs need to have a line like:
#<% org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("edu.cornell.mannlib.vitro.webapp.jsp.SOMEIDFORYOURJSP"); %> #<% org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("edu.cornell.mannlib.vitro.webapp.jsp.SOMEIDFORYOURJSP"); %>
log4j.appender.JspAppender=org.apache.log4j.FileAppender log4j.appender.JspAppender=org.apache.log4j.FileAppender
log4j.appender.JspAppender.File=${tomcat.home}/logs/vitro.jsp.log log4j.appender.JspAppender.File=${tomcat.home}/logs/${logfile.prefix}vitro.jsp.log
log4j.appender.JspAppender.layout=org.apache.log4j.PatternLayout log4j.appender.JspAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.JspAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n log4j.appender.JspAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n
@ -50,7 +48,7 @@ log4j.logger.edu.cornell.mannlib.vitro.webapp.jsp=INFO, JspAppender
#### setup a pellet logger #### setup a pellet logger
log4j.appender.PelletAppender=org.apache.log4j.FileAppender log4j.appender.PelletAppender=org.apache.log4j.FileAppender
log4j.appender.PelletAppender.File=${tomcat.home}/logs/vitro.pellet.log log4j.appender.PelletAppender.File=${tomcat.home}/logs/${logfile.prefix}vitro.pellet.log
log4j.appender.PelletAppender.layout=org.apache.log4j.PatternLayout log4j.appender.PelletAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.PelletAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n log4j.appender.PelletAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n
@ -59,7 +57,7 @@ log4j.logger.org.mindswap=WARN, PelletAppender
#### setup a jena logger #### setup a jena logger
log4j.appender.JenaAppender=org.apache.log4j.FileAppender log4j.appender.JenaAppender=org.apache.log4j.FileAppender
log4j.appender.JenaAppender.File=${tomcat.home}/logs/vitro.jena.log log4j.appender.JenaAppender.File=${tomcat.home}/logs/${logfile.prefix}vitro.jena.log
log4j.appender.JenaAppender.layout=org.apache.log4j.PatternLayout log4j.appender.JenaAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.JenaAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n log4j.appender.JenaAppender.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n

View file

@ -9,12 +9,25 @@
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
#
# The base install directory for your Tomcat server. The VIVO application
# will be deployed in the /webapps directory below this base.
#
tomcat.home = /usr/local/tomcat
#
# The name of the Vitro application. This will be used as the name of the
# subdirectory within your Tomcat server's /webapps directory. It also appears
# in the URL for the application. For example, http://my.vitro.server/vitro
#
webapp.name = vitro
# #
# The location where the VIVO application will store uploaded files # The location where the VIVO application will store uploaded files
# (usually images). You should arrange for these files to be backed up in some # (usually images). You should arrange for these files to be backed up in some
# way. # way.
# #
UploadImagesServlet.sourceDirName = /usr/local/vivo/data/uploads upload.directory = /usr/local/vivo/data/uploads
# #
# The location where the VIVO application will create its Lucene search # The location where the VIVO application will create its Lucene search
@ -35,7 +48,7 @@ Vitro.defaultNamespace = http://vitro.mydomain.edu/individual/
# SMTP host which the "Contact Us" form can use to send mail. If this is left # SMTP host which the "Contact Us" form can use to send mail. If this is left
# empty, the "Contact Us" form will be disabled. # empty, the "Contact Us" form will be disabled.
# #
#Vitro.smtpHost = Vitro.smtpHost =
# #
# The basic parameters for a MySQL database connection. Change the end of the # The basic parameters for a MySQL database connection. Change the end of the
@ -46,3 +59,9 @@ VitroConnection.DataSource.url = jdbc:mysql://localhost/vitro
VitroConnection.DataSource.username = vitroweb VitroConnection.DataSource.username = vitroweb
VitroConnection.DataSource.password = vitrovitro VitroConnection.DataSource.password = vitrovitro
#
# The name of your first admin user for the VIVO application. The password for
# for this user is initially set to "defaultAdmin", but you will be asked to
# change the password the first time you login.
#
initialAdminUser = defaultAdmin

View file

@ -6,14 +6,10 @@
xmlns="http://vitro.mannlib.cornell.edu/ns/vitro/default#" xmlns="http://vitro.mannlib.cornell.edu/ns/vitro/default#"
xml:base="http://vitro.mannlib.cornell.edu/ns/vitro/default"> xml:base="http://vitro.mannlib.cornell.edu/ns/vitro/default">
<!--
<vitro:User rdf:about="#defaultAdminUser"> <vitro:User rdf:about="#defaultAdminUser">
<vitro:username rdf:datatype="http://www.w3.org/2001/XMLSchema#string">defaultAdmin</vitro:username> <vitro:username rdf:datatype="http://www.w3.org/2001/XMLSchema#string">${initialAdminUser}</vitro:username>
<vitro:md5password rdf:datatype="http://www.w3.org/2001/XMLSchema#string">22BA075EC8951A70960A0A95C0BC2294</vitro:md5password> <vitro:md5password rdf:datatype="http://www.w3.org/2001/XMLSchema#string">22BA075EC8951A70960A0A95C0BC2294</vitro:md5password>
<vitro:roleURI rdf:datatype="http://www.w3.org/2001/XMLSchema#string">role:/50</vitro:roleURI> <vitro:roleURI rdf:datatype="http://www.w3.org/2001/XMLSchema#string">role:/50</vitro:roleURI>
</vitro:User> </vitro:User>
-->
</rdf:RDF> </rdf:RDF>

186
webapp/product-build.xml Normal file
View file

@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<!-- ======================================================================
Build script for the Vivo Products.
jeb228
====================================================================== -->
<project name="vivoProduct" default="describe">
<!--
This script should not be run on its own.
It should only be run from the build script of an individual Product.
-->
<fail>
<condition>
<equals arg1="${ant.file.vivoProduct}" arg2="${ant.file}" />
</condition>
This script should not be run by itself.
It should be invoked from the build script of a Vivo product.
</fail>
<!-- - - - - - - - - - - - - - - - - -
properties
File paths are based on this file's parent directory, so we can find
the files even when this script is included into an individual
Product build script.
- - - - - - - - - - - - - - - - - -->
<dirname property="vivoProduct.basedir" file="${ant.file.vivoProduct}" />
<import file="${vivoProduct.basedir}/build.xml" />
<!-- Is there a "src" directory in the product? -->
<property name="product.source.dir" location="./src" />
<available property="product.sources.exist" file="${product.source.dir}" />
<!-- Is there a "test" directory in the product? -->
<property name="product.test.dir" location="./test" />
<available property="product.tests.exist" file="${product.test.dir}" />
<!-- Is there a "themes" directory in the product? -->
<property name="product.themes.dir" location="./themes" />
<available property="product.themes.exist" file="${product.themes.dir}" />
<path id="product.compile.classpath">
<pathelement location="${classes.dir}" />
<path refid="compile.classpath" />
</path>
<path id="product.test.compile.classpath">
<path refid="test.compile.classpath" />
</path>
<path id="product.test.run.classpath">
<path refid="test.run.classpath" />
</path>
<!-- =================================
target: describe
================================= -->
<target name="describe" description="--> The default target.">
<echo>
all - Runs "clean", then "deploy".
clean - Delete all artifacts so the next build will be from scratch.
compile - Compile the Java source files.
test - Compile and run the JUnit tests.
war - Assemble everything into a deployable WAR file.
deploy - Deploy the application directly into the Tomcat webapps directory.
</echo>
</target>
<!-- =================================
target: all
================================= -->
<target name="all" depends="clean, deploy" description="Run 'clean', then 'deploy'" />
<!-- =================================
target: clean
================================= -->
<target name="clean" depends="vitroCore.clean" description="--> Delete all artifacts.">
</target>
<!-- =================================
target: compile
================================= -->
<target name="compile"
depends="vitroCore.compile, productCompile"
description="--> Compile Java sources.">
</target>
<!-- =================================
target: test
================================= -->
<target name="test" depends="vitroCore.test, productTest" description="-->Run JUnit tests">
</target>
<!-- =================================
target: deploy
================================= -->
<target name="deploy" depends="productCopy, vitroCore.deploy" description="description">
</target>
<!-- - - - - - - - - - - - - - - - - -
target: productCopy
- - - - - - - - - - - - - - - - - -->
<target name="productCopy" depends="copyEtc, test">
<copy todir="${build.dir}/war/themes">
<fileset dir="${product.themes.dir}" />
</copy>
<!-- TODO: Merge these into the productMods -->
<copy todir="${build.dir}/war/WEB-INF/ontologies/user">
<fileset dir="./ontology" />
</copy>
<copy todir="${build.dir}/war/WEB-INF/submodels">
<fileset dir="./model/submodels" />
</copy>
<copy todir="${build.dir}/war/WEB-INF/init-data">
<fileset dir="./model/init-data" />
</copy>
<!-- TODO: Merge these into the productMods -->
<!-- TODO: Have the Jena code read the userId directly from the deploy.properties -->
<copy file="config/vitroUsers.owl.template"
tofile="${build.dir}/war/WEB-INF/ontologies/auth/vitroUsers.owl"
filtering="true">
<filterchain>
<expandproperties />
</filterchain>
</copy>
<!-- TODO: Have the Jena code read the userId directly from the deploy.properties -->
<copy todir="${build.dir}/war">
<fileset dir="./modifications" />
</copy>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: productCompile
- - - - - - - - - - - - - - - - - -->
<target name="productCompile" depends="vitroCore.compile" if="product.sources.exist">
<!-- deletes all files that depend on changed .java files -->
<depend srcdir="${product.source.dir}"
destdir="${classes.dir}"
closure="false"
cache="${build.dir}/.depcache">
<classpath refid="product.compile.classpath" />
</depend>
<javac srcdir="${product.source.dir}"
destdir="${classes.dir}"
debug="true"
deprecation="true"
optimize="true"
source="1.5">
<classpath refid="product.compile.classpath" />
</javac>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: productTest
- - - - - - - - - - - - - - - - - -->
<target name="productTest" depends="vitroCore.test" if="product.tests.exist">
<javac srcdir="${product.test.dir}"
destdir="${test.classes.dir}"
debug="true"
deprecation="true"
optimize="false"
source="1.5">
<classpath refid="product.test.compile.classpath" />
</javac>
<java classname="edu.cornell.mannlib.vitro.testing.VitroTestRunner"
fork="yes"
failonerror="true">
<classpath refid="product.test.run.classpath" />
<arg file="${product.test.dir}" />
<arg value="${testlevel}" />
</java>
</target>
</project>

View file

@ -0,0 +1,10 @@
#
# A simple Log4J configuration for unit tests.
#
# It's not very important, because the tests themselves will override this
# configuration in AbstractTestClass.initializeLogging().
#
log4j.rootLogger=WARN, AllAppender
log4j.appender.AllAppender=org.apache.log4j.ConsoleAppender
log4j.appender.AllAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.AllAppender.layout.ConversionPattern=%p %t %c - %m%n