How do I add a folder to the classpath of a Tomcat container being started by the maven cargo plugin

StackOverflow https://stackoverflow.com/questions/12189997

  •  29-06-2021
  •  | 
  •  

Question

I am using the cargo-maven2-plugin to start and stop a tomcat container from my maven build. I am able to get this working for my application including the deployment of extra jar files not included in the war. However, the war file I am deploying needs to have a directory/folder of groovy scripts included in the tomcat common classpath.

Is it possible to configure this cargo plugin to add a folder to the tomcat common classpath? Note, I am not looking to include a jar dependency into this classpath - just the folder of groovy scripts.

Edit: So far I have worked around this by copying in a new catalina.properties file that contains this folder. This works, but it is very container specific.

Was it helpful?

Solution

You can add a section to include file or directories, for instance

              <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <version>1.2.3</version>
                    <configuration>
                        <container>
                           ...
                        </container>
                        <configuration>
                            <properties>
                               ....
                            </properties>
                            <files>
                                <file>
                                    <file>${basedir}/src/test/resources/alfresco-global.properties</file>
                                    <todir>shared/classes</todir>
                                </file>
                            </files>
                        </configuration>
                    </configuration>
                    <executions>
                        ...
                    </executions>
                </plugin>

Further documentation in Maven 2 Plugin Reference Guide

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top