Set virtual class path up correctly. Running 'mvn compile' makes sure the changes

end up in target/${project.build.finalName}/config. This causes issues when
changing existing files after starting/restarting, since integration-test makes
the files appear in target/test-classes. The app would then only serve the file
in target/test-classes and ignore the rest.

By switching these we can strive for having 'mvn compile' do everything we need
to ensure hot reloading works.
This commit is contained in:
Ole Hejlskov
2015-04-07 17:37:24 +02:00
parent c62178aadf
commit a7856633ec
5 changed files with 48 additions and 9 deletions

View File

@@ -16,9 +16,16 @@
extraResourcePaths="/=${project.parent.basedir}/repo-amp/target/repo-amp/web" /> extraResourcePaths="/=${project.parent.basedir}/repo-amp/target/repo-amp/web" />
<!-- Configure where the Alfresco (alfresco.war) web application can load classes, test classes, and config files --> <!-- Configure where the Alfresco (alfresco.war) web application can load classes, test classes, and config files -->
<!-- Setup the virtual class path like this:
1) target/classes
2) target/${project.build.finalName}/config
3) target/test-classes
This way mvn compile can be invoked and all changes will be picked up
-->
<Loader className="org.apache.catalina.loader.VirtualWebappLoader" <Loader className="org.apache.catalina.loader.VirtualWebappLoader"
searchVirtualFirst="true" searchVirtualFirst="true"
virtualClasspath="${project.parent.basedir}/repo-amp/target/classes;${project.parent.basedir}/repo-amp/target/test-classes;${project.parent.basedir}/repo-amp/target/repo-amp/config" /> virtualClasspath="${project.parent.basedir}/repo-amp/target/classes;${project.parent.basedir}/repo-amp/target/repo-amp/config;${project.parent.basedir}/repo-amp/target/test-classes" />
<!-- Load from all directories, not just when the META-INF directory is found in exploded JAR --> <!-- Load from all directories, not just when the META-INF directory is found in exploded JAR -->
<JarScanner scanAllDirectories="true" /> <JarScanner scanAllDirectories="true" />

View File

@@ -13,9 +13,16 @@
extraResourcePaths="/=${project.parent.basedir}/share-amp/target/share-amp/web" /> extraResourcePaths="/=${project.parent.basedir}/share-amp/target/share-amp/web" />
<!-- Configure where the Share (share.war) web application can load classes, test classes, and config --> <!-- Configure where the Share (share.war) web application can load classes, test classes, and config -->
<!-- Setup the virtual class path like this:
1) target/classes
2) target/${project.build.finalName}/config
3) target/test-classes
This way mvn compile can be invoked and all changes will be picked up
-->
<Loader className="org.apache.catalina.loader.VirtualWebappLoader" <Loader className="org.apache.catalina.loader.VirtualWebappLoader"
searchVirtualFirst="true" searchVirtualFirst="true"
virtualClasspath="${project.parent.basedir}/share-amp/target/classes;${project.parent.basedir}/share-amp/target/test-classes;${project.parent.basedir}/share-amp/target/share-amp/config" /> virtualClasspath="${project.parent.basedir}/share-amp/target/classes;${project.parent.basedir}/share-amp/target/share-amp/config;${project.parent.basedir}/share-amp/target/test-classes" />
<!-- Load from all directories, not just when the META-INF directory is found in exploded JAR --> <!-- Load from all directories, not just when the META-INF directory is found in exploded JAR -->
<JarScanner scanAllDirectories="true" /> <JarScanner scanAllDirectories="true" />

View File

@@ -14,9 +14,17 @@
<Resources className="org.apache.naming.resources.VirtualDirContext" <Resources className="org.apache.naming.resources.VirtualDirContext"
extraResourcePaths="/=${project.build.directory}/${project.build.finalName}/web" /> extraResourcePaths="/=${project.build.directory}/${project.build.finalName}/web" />
<!-- Setup the virtual class path like this:
1) target/classes
2) target/${project.build.finalName}/config
3) target/test-classes
This way mvn compile can be invoked and all changes will be picked up
-->
<Loader searchVirtualFirst="true" <Loader searchVirtualFirst="true"
className="org.apache.catalina.loader.VirtualWebappLoader" className="org.apache.catalina.loader.VirtualWebappLoader"
virtualClasspath="${project.build.outputDirectory};${project.build.testOutputDirectory};${project.build.directory}/${project.build.finalName}/config" /> virtualClasspath="${project.build.outputDirectory};${project.build.directory}/${project.build.finalName}/config;${project.build.testOutputDirectory}" />
<!-- This enables hot reloading of web resources from uncompressed jars (while in prod they would be loaded from WEB-INF/lib/{\*.jar}/META-INF/resources --> <!-- This enables hot reloading of web resources from uncompressed jars (while in prod they would be loaded from WEB-INF/lib/{\*.jar}/META-INF/resources -->
<JarScanner scanAllDirectories="true" /> <JarScanner scanAllDirectories="true" />

View File

@@ -1,4 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================================================================
This context file is used only in a development IDE for rapid development,
it is never released with the Alfresco.war
=================================================================================================================-->
-->
<!-- Setup docBase to something like share-amp/target/share-amp-war <!-- Setup docBase to something like share-amp/target/share-amp-war
and path to /share --> and path to /share -->
<Context docBase="${app.amp.client.war.folder}" path="${share.client.contextPath}"> <Context docBase="${app.amp.client.war.folder}" path="${share.client.contextPath}">
@@ -7,8 +13,16 @@
extraResourcePaths="/=${project.build.directory}/${project.build.finalName}/web" /> extraResourcePaths="/=${project.build.directory}/${project.build.finalName}/web" />
<Loader searchVirtualFirst="true" className="org.apache.catalina.loader.VirtualWebappLoader" <!-- Setup the virtual class path like this:
virtualClasspath="${project.build.outputDirectory};${project.build.testOutputDirectory};${project.build.directory}/${project.build.finalName}/config" /> 1) target/classes
2) target/${project.build.finalName}/config
3) target/test-classes
This way mvn compile can be invoked and all changes will be picked up
-->
<Loader searchVirtualFirst="true"
className="org.apache.catalina.loader.VirtualWebappLoader"
virtualClasspath="${project.build.outputDirectory};${project.build.directory}/${project.build.finalName}/config;${project.build.testOutputDirectory}" />
<!-- This enables hot reloading of web resources from uncompressed jars (while in prod they would be loaded from WEB-INF/lib/{\*.jar}/META-INF/resources --> <!-- This enables hot reloading of web resources from uncompressed jars (while in prod they would be loaded from WEB-INF/lib/{\*.jar}/META-INF/resources -->
<JarScanner scanAllDirectories="true" /> <JarScanner scanAllDirectories="true" />

View File

@@ -492,6 +492,9 @@
<version>1.0</version> <version>1.0</version>
<executions> <executions>
<execution> <execution>
<!-- Important to do this in the compile phase, otherwise the files will be copied
after this and the web script refresh will not be recognized
-->
<phase>compile</phase> <phase>compile</phase>
<goals> <goals>
<goal>execute</goal> <goal>execute</goal>