Is it possible to supply Tomcat6's context.xml file via the Maven Cargo plugin?

前端 未结 3 1546
野的像风
野的像风 2020-12-10 05:44

I\'d like to keep Tomcat\'s context.xml file out of my WAR file\'s META-INF directory if possible. Can this be done with Maven\'s cargo plugin? I can\'t seem to find the c

3条回答
  •  有刺的猬
    2020-12-10 06:13

    I haven't found a way to do this yet, but I have come up with a work around that works in my project. I currently have a project with essentially 3 submodules:

        dependencies
        webapp
        smoketest
    

    When I'm building the "webapp" project, I execute the following plugin declaration:

    
        org.apache.maven.plugins
        maven-war-plugin
        
            
            create-war-smoketest
            verify
            
                war
            
            
                ${project.build.directory}/exploded
                false
                smoketest
                
                
                    true
                    src/test/resources/smoketest
                    META-INF
                    
                        context.xml
                    
                
                
            
            
        
    
    

    And then when I'm running my Cargo/WebTest suite in the SmokeTest project, I specify the smoketest WAR file as a dependency and in my Cargo configuration set my deployrables thusly:

    
        
            ${pom.groupId}
            webapp
            war
            
                smoketest
            
        
    
    

    With the dependency looking something like:

    
        
            ${pom.groupId}
            webapp
            ${pom.version}
            smoketest
            war
            system
            
            ${basedir}/../webapp/target/webapp-${pom.version}-smoketest.war
        
    
    

    It's extremely dirty, but it at least works... for now. One quick note: my comment about forcing it to never look for a version in the repo is possibly incorrect at this point; I think this trick may have been broken by a change to the dependency plugin at some point.

提交回复
热议问题