Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

maven-plugin: import code as defined in the ip clearance.

NOTE: next commits will change package


git-svn-id: https://svn.apache.org/repos/asf/tomcat/maven-plugin/trunk@1163136 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 6d2c7b2aae3f59d802f8dea57307d388d4fa0920 1 parent 99b31ce
@olamy olamy authored
Showing with 8,728 additions and 0 deletions.
  1. +315 −0 LICENSE.txt
  2. +352 −0 pom.xml
  3. +28 −0 src/site/site.xml
  4. +145 −0 tomcat-maven-plugin-it/pom.xml
  5. +193 −0 tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractWarProjectIT.java
  6. +68 −0 tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/SimpleWarProjectIT.java
  7. +94 −0 tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/TomcatRunMultiConfigIT.java
  8. +71 −0 tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/UsageContextpathIT.java
  9. +119 −0 tomcat-maven-plugin-it/src/test/project-resources/simple-war-project/pom.xml
  10. +19 −0 tomcat-maven-plugin-it/src/test/project-resources/simple-war-project/src/main/tomcatconf/empty.txt
  11. +43 −0 tomcat-maven-plugin-it/src/test/project-resources/simple-war-project/src/main/tomcatconf/server.xml
  12. +17 −0 tomcat-maven-plugin-it/src/test/project-resources/simple-war-project/src/main/webapp/index.jsp
  13. +26 −0 tomcat-maven-plugin-it/src/test/project-resources/simple-war-project/src/main/webapp/web.xml
  14. +30 −0 tomcat-maven-plugin-it/src/test/project-resources/simple-war-project/src/test/java/WaitIT.java
  15. +132 −0 tomcat-maven-plugin-it/src/test/project-resources/tomcat-run-multi-config/pom.xml
  16. +19 −0 tomcat-maven-plugin-it/src/test/project-resources/tomcat-run-multi-config/src/main/tcconf/empty.txt
  17. +40 −0 tomcat-maven-plugin-it/src/test/project-resources/tomcat-run-multi-config/src/main/webapp/index.jsp
  18. +38 −0 tomcat-maven-plugin-it/src/test/project-resources/tomcat-run-multi-config/src/main/webapp/web.xml
  19. +30 −0 tomcat-maven-plugin-it/src/test/project-resources/tomcat-run-multi-config/src/test/java/WaitIT.java
  20. +107 −0 tomcat-maven-plugin-it/src/test/project-resources/usage-contextpath/pom.xml
  21. +29 −0 tomcat-maven-plugin-it/src/test/project-resources/usage-contextpath/src/main/webapp/index.html
  22. +31 −0 tomcat-maven-plugin-it/src/test/project-resources/usage-contextpath/src/test/java/WaitIT.java
  23. +34 −0 tomcat-maven-plugin-it/src/test/resources/logback-test.xml
  24. +176 −0 tomcat-maven-plugin/pom.xml
  25. +275 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/AbstractCatalinaMojo.java
  26. +215 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/AbstractDeployMojo.java
  27. +87 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/AbstractDeployWarMojo.java
  28. +139 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/AbstractI18NMojo.java
  29. +847 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/AbstractRunMojo.java
  30. +76 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/AbstractRunWarMojo.java
  31. +86 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/AbstractWarCatalinaMojo.java
  32. +34 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/DeployMojo.java
  33. +34 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/DeployOnlyMojo.java
  34. +151 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/EmbeddedRegistry.java
  35. +74 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/ExplodedMojo.java
  36. +164 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/ExternalRepositoriesReloadableWebappLoader.java
  37. +74 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/InplaceMojo.java
  38. +51 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/ListMojo.java
  39. +45 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/RedeployMojo.java
  40. +51 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/ReloadMojo.java
  41. +69 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/ResourcesMojo.java
  42. +51 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/RolesMojo.java
  43. +287 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/RunMojo.java
  44. +37 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/RunWarMojo.java
  45. +36 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/RunWarOnlyMojo.java
  46. +51 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/ServerInfoMojo.java
  47. +51 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/SessionsMojo.java
  48. +61 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/ShutdownMojo.java
  49. +51 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/StartMojo.java
  50. +51 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/StopMojo.java
  51. +729 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/TomcatManager.java
  52. +72 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/TomcatManagerException.java
  53. +74 −0 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/UndeployMojo.java
  54. +26 −0 tomcat-maven-plugin/src/main/resources/conf/tomcat-users.xml
  55. +1,200 −0 tomcat-maven-plugin/src/main/resources/conf/web.xml
  56. +107 −0 tomcat-maven-plugin/src/main/resources/org/codehaus/mojo/tomcat/messages.properties
  57. +84 −0 tomcat-maven-plugin/src/site/apt/container-goals.apt
  58. +110 −0 tomcat-maven-plugin/src/site/apt/context-goals.apt
  59. +58 −0 tomcat-maven-plugin/src/site/apt/examples/add-system-properties.apt.vm
  60. +124 −0 tomcat-maven-plugin/src/site/apt/examples/adjust-embedded-tomcat-version.apt.vm
  61. +128 −0 tomcat-maven-plugin/src/site/apt/examples/deployment-tomcat7.apt.vm
  62. +384 −0 tomcat-maven-plugin/src/site/apt/examples/deployment.apt.vm
  63. +53 −0 tomcat-maven-plugin/src/site/apt/index.apt
  64. +183 −0 tomcat-maven-plugin/src/site/apt/usage.apt.vm
  65. +53 −0 tomcat-maven-plugin/src/site/fml/faq.fml
  66. +39 −0 tomcat-maven-plugin/src/site/site.xml
View
315 LICENSE.txt
@@ -0,0 +1,315 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
+For Java Service Wrapper v3.2.3:
+
+Copyright (c) 1999, 2006 Tanuki Software, Inc.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of the Java Service Wrapper and associated
+documentation files (the "Software"), to deal in the Software
+without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sub-license,
+and/or sell copies of the Software, and to permit persons to
+whom the Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+
+Portions of the Software have been derived from source code
+developed by Silver Egg Technology under the following license:
+
+BEGIN Silver Egg Techology License -----------------------------------
+
+ Copyright (c) 2001 Silver Egg Technology
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sub-license, and/or
+ sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+END Silver Egg Techology License -------------------------------------
+
+
+For jQuery 1.3.2:
+
+Copyright (c) 2009 John Resig, http://jquery.com/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+For JQuery UI 1.7.2:
+
+Copyright (c) 2009 Paul Bakaus, http://jqueryui.com/
+
+This software consists of voluntary contributions made by many
+individuals (AUTHORS.txt, http://jqueryui.com/about) For exact
+contribution history, see the revision history and logs, available
+at http://jquery-ui.googlecode.com/svn/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
View
352 pom.xml
@@ -0,0 +1,352 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>mojo-parent</artifactId>
+ <version>27</version>
+ <relativePath>../mojo-parent/pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tomcat-maven-plugin-parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tomcat Maven Plugin Project</name>
+ <version>1.2-SNAPSHOT</version>
+ <description>The Tomcat Maven Plugin provides goals to manipulate WAR projects within the Tomcat servlet
+ container.
+ </description>
+
+ <properties>
+ <tomcat.version>6.0.32</tomcat.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.source>1.5</maven.compiler.source>
+ <maven.compiler.target>1.5</maven.compiler.target>
+ <mavenVersion>2.0.8</mavenVersion>
+ <!-- Test settings -->
+ <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
+ <failsafe.version>2.6</failsafe.version>
+ <junit.version>4.8.1</junit.version>
+ </properties>
+
+ <prerequisites>
+ <maven>${mavenVersion}</maven>
+ </prerequisites>
+ <inceptionYear>2005</inceptionYear>
+
+ <developers>
+ <developer>
+ <id>mhobson</id>
+ <name>Mark Hobson</name>
+ <email>markhobson@gmail.com</email>
+ <roles>
+ <role>Lead Developer</role>
+ </roles>
+ <timezone>0</timezone>
+ </developer>
+ <developer>
+ <id>olamy</id>
+ <name>Olivier Lamy</name>
+ <email>olamy@apache.org</email>
+ </developer>
+ <developer>
+ <id>thragor</id>
+ <name>Mark Michaelis</name>
+ <email>thragor@gmx.net</email>
+ <url>http://thragor.blogspot.com/</url>
+ <timezone>+2</timezone>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ </developer>
+ </developers>
+
+ <contributors>
+ <contributor>
+ <name>Jurgen Lust</name>
+ </contributor>
+ <contributor>
+ <name>Spike Washburn</name>
+ </contributor>
+ </contributors>
+
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:svn:http://svn.codehaus.org/mojo/trunk/mojo/tomcat-maven-plugin</connection>
+ <developerConnection>scm:svn:https://svn.codehaus.org/mojo/trunk/mojo/tomcat-maven-plugin</developerConnection>
+ <url>http://fisheye.codehaus.org/browse/mojo/trunk/mojo/tomcat-maven-plugin</url>
+ </scm>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>http://jira.codehaus.org/browse/MTOMCAT</url>
+ </issueManagement>
+
+ <modules>
+ <module>tomcat-maven-plugin</module>
+ <!-- Module tomcat-maven-plugin-it is activated with the profile integration-test -->
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact-manager</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-provider-api</artifactId>
+ <version>1.0-alpha-5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-classworlds</artifactId>
+ <version>2.2.2</version>
+ </dependency>
+
+ <!-- tomcat dependencies -->
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>${tomcat.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina-ha</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tribes</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>el-api</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt.core.compiler</groupId>
+ <artifactId>ecj</artifactId>
+ <version>3.5.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>jasper</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>jasper-el</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>coyote</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>dbcp</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- Test Dependencies -->
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit-addons</groupId>
+ <artifactId>junit-addons</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-verifier</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>0.9.24</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>0.9.24</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Override settings inherited from parent POM -->
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>${failsafe.version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <createChecksum>true</createChecksum>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.5</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-metadata</artifactId>
+ <version>1.5.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>integration-test</id>
+ <!-- The integration tests require that the test artifacts are installed
+ first to a local repository. -->
+ <modules>
+ <module>tomcat-maven-plugin-it</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <!-- For integration tests the plugin needs to be installed before
+ the integration tests are executed -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ <phase>pre-integration-test</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
View
28 src/site/site.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<project name="Tomcat Maven Plugin">
+ <body>
+ <breadcrumbs>
+ <item name="tomcat-maven-plugin" href="index.html" mce_href="index.html"/>
+ </breadcrumbs>
+ <menu ref="modules"/>
+ <menu ref="reports"/>
+ </body>
+</project>
View
145 tomcat-maven-plugin-it/pom.xml
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>tomcat-maven-plugin-parent</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <version>1.2-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>tomcat-maven-plugin-it</artifactId>
+ <packaging>jar</packaging>
+ <name>Tomcat Maven Plugin Integration Tests</name>
+
+ <description>
+ Integration Tests for the Tomcat-Maven-Plugin. To run the tests start this module with
+ profile "integration-test":
+
+ mvn clean verify -P integration-test
+
+ To ensure that every dependency is installed before to your local repository you might
+ call the parent POM with:
+
+ mvn clean verify -am -P integration-test -pl tomcat-maven-plugin-it
+ </description>
+
+ <properties>
+ <!-- Nothing to deploy - just tests -->
+ <maven.deploy.skip>true</maven.deploy.skip>
+ <!-- The time to wait between startup and shutdown of tomcat. Realized by a test which waits for the specified
+ time. -->
+ <it.sleep.time>2000</it.sleep.time>
+ <maven.resources.escapeString>\</maven.resources.escapeString>
+ </properties>
+
+ <build>
+ <defaultGoal>verify</defaultGoal>
+
+ <plugins>
+
+ <!-- Don't run "normal" tests -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ <testResources>
+ <testResource>
+ <directory>src/test/project-resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>false</filtering>
+ </testResource>
+ </testResources>
+ </build>
+
+ <dependencies>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit-addons</groupId>
+ <artifactId>junit-addons</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-verifier</artifactId>
+ </dependency>
+ <!-- No real dependency - just to ensure the correct build order by dependency resolution -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ <type>maven-plugin</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
View
193 tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractWarProjectIT.java
@@ -0,0 +1,193 @@
+package org.codehaus.mojo.tomcat.it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ResponseHandler;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpHead;
+import org.apache.http.impl.client.BasicResponseHandler;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
+import org.apache.maven.it.VerificationException;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+import org.junit.After;
+import org.junit.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base class for all tests which have a war-project using the tomcat-maven-plugin below project-resources.
+ *
+ * @author Mark Michaelis
+ */
+public abstract class AbstractWarProjectIT
+{
+ private static final Logger LOG = LoggerFactory.getLogger( AbstractWarProjectIT.class );
+
+ /**
+ * This URL will be queried for content. It will also be used to wait for the startup of the webapp.
+ *
+ * @return the URL to ping
+ */
+ protected abstract String getWebappUrl();
+
+ /**
+ * Artifact ID of the war project. Needed to uninstall any artifacts.
+ *
+ * @return artifact ID of the war project under test
+ */
+ protected abstract String getWarArtifactId();
+
+ /**
+ * HttpClient to use to connect to the deployed web-application.
+ */
+ private DefaultHttpClient httpClient;
+
+ /**
+ * Helper for Maven-Integration-Tests.
+ */
+ protected Verifier verifier;
+
+ /**
+ * Where the war project got placed to.
+ */
+ protected File webappHome;
+
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ httpClient = new DefaultHttpClient();
+
+ final HttpParams params = httpClient.getParams();
+ HttpConnectionParams.setConnectionTimeout( params, 15000 );
+ HttpConnectionParams.setSoTimeout( params, 15000 );
+
+ webappHome = ResourceExtractor.simpleExtractResources( getClass(), "/" + getWarArtifactId() );
+ verifier = new Verifier( webappHome.getAbsolutePath() );
+ verifier.deleteArtifact( "org.codehaus.mojo.tomcat.it", getWarArtifactId(), "1.0-SNAPSHOT", "war" );
+ }
+
+ @After
+ public void tearDown()
+ throws Exception
+ {
+ httpClient.getConnectionManager().shutdown();
+ verifier.resetStreams();
+ verifier.deleteArtifact( "org.codehaus.mojo.tomcat.it", getWarArtifactId(), "1.0-SNAPSHOT", "war" );
+ }
+
+ /**
+ * Executes mvn verify and retrieves the response from the web application.
+ * @return the response given
+ * @throws VerificationException if the verifier failed to execute the goal
+ * @throws InterruptedException if the execution got interrupted in some way
+ */
+ protected final String executeVerifyWithGet()
+ throws VerificationException, InterruptedException
+ {
+ final String[] responseBodies = new String[]{ null };
+
+ final Thread thread = new Thread( "webapp-response-retriever" )
+ {
+ @Override
+ public void run()
+ {
+ responseBodies[0] = getResponseBody( 15000 );
+ }
+ };
+
+ thread.start();
+
+ LOG.info( "Executing verify on " + webappHome.getAbsolutePath() );
+ verifier.executeGoal( "verify" );
+
+ thread.join();
+
+ return responseBodies[0];
+ }
+
+ private String getResponseBody( int timeout )
+ {
+ String responseBody = null;
+ final long startTime = System.currentTimeMillis();
+ final long endTime = startTime + timeout;
+ long currentTime = System.currentTimeMillis();
+ try
+ {
+ while ( pingUrl() != 200 && currentTime < endTime )
+ {
+ LOG.debug( "Ping..." );
+ Thread.sleep( 500 );
+ currentTime = System.currentTimeMillis();
+ }
+ if ( currentTime < endTime )
+ {
+ responseBody = getResponseBody();
+ LOG.debug( "Received: " + responseBody );
+ }
+ else
+ {
+ LOG.error( "Timeout met while trying to access web application." );
+ }
+ }
+ catch ( IOException e )
+ {
+ LOG.error( "Exception while trying to access web application.", e );
+ }
+ catch ( InterruptedException e )
+ {
+ LOG.error( "Exception while trying to access web application.", e );
+ }
+ return responseBody;
+ }
+
+ private String getResponseBody()
+ throws IOException
+ {
+ HttpGet httpGet = new HttpGet( getWebappUrl() );
+ ResponseHandler<String> responseHandler = new BasicResponseHandler();
+ return httpClient.execute( httpGet, responseHandler );
+ }
+
+ private int pingUrl()
+ {
+ final HttpHead httpHead = new HttpHead( getWebappUrl() );
+ try
+ {
+ final HttpResponse response = httpClient.execute( httpHead );
+ return response.getStatusLine().getStatusCode();
+ }
+ catch ( IOException e )
+ {
+ LOG.debug( "Ignoring exception while pinging URL " + httpHead.getURI(), e );
+ return -1;
+ }
+ }
+
+}
View
68 tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/SimpleWarProjectIT.java
@@ -0,0 +1,68 @@
+package org.codehaus.mojo.tomcat.it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+
+import static junitx.framework.StringAssert.assertContains;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Mark Michaelis
+ */
+public class SimpleWarProjectIT
+ extends AbstractWarProjectIT
+{
+ private static final Logger LOG = LoggerFactory.getLogger( SimpleWarProjectIT.class );
+
+ @Override
+ protected String getWebappUrl()
+ {
+ return "http://localhost:8080/";
+ }
+
+ @Override
+ protected String getWarArtifactId()
+ {
+ return "simple-war-project";
+ }
+
+ @Test
+ public void testIt()
+ throws Exception
+ {
+ final String responseBody = executeVerifyWithGet();
+ assertNotNull( "Received message body must not be null.", responseBody );
+ assertContains( "Response must match expected content.", "It works !!", responseBody );
+
+ assertTrue( "Tomcat folder should exist in target folder of project at " + webappHome,
+ new File( webappHome, "target/tomcat" ).exists() );
+ LOG.info( "Error Free Log check" );
+ verifier.verifyErrorFreeLog();
+ }
+
+}
View
94 tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/TomcatRunMultiConfigIT.java
@@ -0,0 +1,94 @@
+package org.codehaus.mojo.tomcat.it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import static junitx.framework.StringAssert.assertContains;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests a bunch of configuration options for the tomcat-run Mojo.
+ *
+ * @author Mark Michaelis
+ */
+public final class TomcatRunMultiConfigIT
+ extends AbstractWarProjectIT
+{
+ private static final Logger LOG = LoggerFactory.getLogger( TomcatRunMultiConfigIT.class );
+
+ private static final String URL_QUERY = "\u3053\u3093\u306b\u3061\u306f";
+
+ /**
+ * ArtifactId of the sample WAR project.
+ */
+ private static final String WAR_ARTIFACT_ID = "tomcat-run-multi-config";
+
+ @Override
+ protected String getWebappUrl()
+ {
+ try
+ {
+ return new URI( "http://localhost:8001/multi-config/index.jsp?string=" + URL_QUERY ).toASCIIString();
+ }
+ catch ( URISyntaxException e )
+ {
+ LOG.error( "An exception occurred.", e );
+ return "http://localhost:8001/multi-config";
+ }
+ }
+
+ @Override
+ protected String getWarArtifactId()
+ {
+ return WAR_ARTIFACT_ID;
+ }
+
+ @Test
+ public void testIt()
+ throws Exception
+ {
+ final String responseBody = executeVerifyWithGet();
+ assertNotNull( "Received message body from " + getWebappUrl() + " must not be null.", responseBody );
+ assertContains( "Response from " + getWebappUrl() + " must match expected content.", URL_QUERY, responseBody );
+
+ final File tomcatFolder = new File( webappHome, "target/tc" );
+ final File emptyLocation = new File( tomcatFolder, "conf/empty.txt" );
+
+ assertTrue(
+ "Tomcat folder \"" + tomcatFolder.getAbsolutePath() + "\" should exist in target folder of project at " +
+ webappHome, tomcatFolder.exists() );
+ assertTrue(
+ "File \"" + emptyLocation.getAbsolutePath() + "\" should have been copied from tcconf to tomcat/conf",
+ emptyLocation.exists() );
+
+ LOG.info( "Error Free Log check" );
+ verifier.verifyErrorFreeLog();
+ }
+
+}
View
71 tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/UsageContextpathIT.java
@@ -0,0 +1,71 @@
+package org.codehaus.mojo.tomcat.it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static junitx.framework.StringAssert.assertContains;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Tests the example "Using a different context path" as the WAR gets deployed below the contextpath /lorem.
+ *
+ * @author Mark Michaelis
+ */
+public final class UsageContextpathIT
+ extends AbstractWarProjectIT
+{
+ private static final Logger LOG = LoggerFactory.getLogger( UsageContextpathIT.class );
+
+ private static final String WEBAPP_URL = "http://localhost:8080/lorem/index.html";
+
+ /**
+ * ArtifactId of the sample WAR project.
+ */
+ private static final String WAR_ARTIFACT_ID = "usage-contextpath";
+
+ @Override
+ protected String getWebappUrl()
+ {
+ return WEBAPP_URL;
+ }
+
+ @Override
+ protected String getWarArtifactId()
+ {
+ return WAR_ARTIFACT_ID;
+ }
+
+ @Test
+ public void testIt()
+ throws Exception
+ {
+ final String responseBody = executeVerifyWithGet();
+ assertNotNull( "Received message body must not be null.", responseBody );
+ assertContains( "Response must match expected content.", "Success!", responseBody );
+
+ LOG.info( "Error Free Log check" );
+ verifier.verifyErrorFreeLog();
+ }
+
+}
View
119 tomcat-maven-plugin-it/src/test/project-resources/simple-war-project/pom.xml
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.codehaus.mojo.tomcat.it</groupId>
+ <artifactId>simple-war-project</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <properties>
+ <pluginVersion>${project.version}</pluginVersion>
+ <maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
+ <maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
+ <project.build.sourceEncoding>${project.build.sourceEncoding}</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1-alpha-2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webXml>src/main/webapp/web.xml</webXml>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>tomcat-run</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <fork>true</fork>
+ <path>/</path>
+ <systemProperties>
+ <com.sun.management.jmxremote.ssl>false</com.sun.management.jmxremote.ssl>
+ </systemProperties>
+ </configuration>
+ </execution>
+ <execution>
+ <id>tomcat-shutdown</id>
+ <goals>
+ <goal>shutdown</goal>
+ </goals>
+ <phase>post-integration-test</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>${failsafe.version}</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ <version>2.5.6</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
View
19 tomcat-maven-plugin-it/src/test/project-resources/simple-war-project/src/main/tomcatconf/empty.txt
@@ -0,0 +1,19 @@
+ ~~ Licensed to the Apache Software Foundation (ASF) under one
+ ~~ or more contributor license agreements. See the NOTICE file
+ ~~ distributed with this work for additional information
+ ~~ regarding copyright ownership. The ASF licenses this file
+ ~~ to you under the Apache License, Version 2.0 (the
+ ~~ "License"); you may not use this file except in compliance
+ ~~ with the License. You may obtain a copy of the License at
+ ~~
+ ~~ http://www.apache.org/licenses/LICENSE-2.0
+ ~~
+ ~~ Unless required by applicable law or agreed to in writing,
+ ~~ software distributed under the License is distributed on an
+ ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~~ KIND, either express or implied. See the License for the
+ ~~ specific language governing permissions and limitations
+ ~~ under the License.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
View
43 tomcat-maven-plugin-it/src/test/project-resources/simple-war-project/src/main/tomcatconf/server.xml
@@ -0,0 +1,43 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<Server port="8010" shutdown="SHUTDOWN">
+
+ <GlobalNamingResources>
+ <!-- Used by Manager webapp -->
+ <Resource name="UserDatabase" auth="Container"
+ type="org.apache.catalina.UserDatabase"
+ description="User database that can be updated and saved"
+ factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+ pathname="conf/tomcat-users.xml" />
+ </GlobalNamingResources>
+
+ <Service name="Catalina">
+ <Connector port="8080" keepAliveTimeout="1800000" maxKeepAliveRequests="30000" maxThreads="300" />
+ <Connector port="8088" keepAliveTimeout="1800000" maxKeepAliveRequests="30000" maxThreads="300" />
+ <Engine name="Catalina" defaultHost="localhost">
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ resolveHosts="false" pattern="%t-ip:%a-protocol:%H-localPort:%p-path:%U-time:%D ms"/>
+ <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+ resourceName="UserDatabase" />
+ <Host name="localhost" appBase="webapps" />
+ </Engine>
+
+ </Service>
+</Server>
View
17 tomcat-maven-plugin-it/src/test/project-resources/simple-war-project/src/main/webapp/index.jsp
@@ -0,0 +1,17 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+It works !!
View
26 tomcat-maven-plugin-it/src/test/project-resources/simple-war-project/src/main/webapp/web.xml
@@ -0,0 +1,26 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+
+</web-app>
View
30 tomcat-maven-plugin-it/src/test/project-resources/simple-war-project/src/test/java/WaitIT.java
@@ -0,0 +1,30 @@
+import org.junit.Test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+@SuppressWarnings({"WrongPackageStatement"})
+public final class WaitIT {
+ @Test
+ public void testWait() throws Exception {
+ System.out.println("Just wait a while...");
+ Thread.sleep(${it.sleep.time});
+ }
+}
View
132 tomcat-maven-plugin-it/src/test/project-resources/tomcat-run-multi-config/pom.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.codehaus.mojo.tomcat.it</groupId>
+ <artifactId>tomcat-run-multi-config</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+
+ <properties>
+ <!-- Set to false if you want to debug the tomcat -->
+ <maven.tomcat.fork>true</maven.tomcat.fork>
+ <pluginVersion>${project.version}</pluginVersion>
+ <maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
+ <maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
+ <project.build.sourceEncoding>${project.build.sourceEncoding}</project.build.sourceEncoding>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </properties>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webXml>src/main/webapp/web.xml</webXml>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>tomcat-run</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <additionalConfigFilesDir>\${basedir}/src/main/tcconf</additionalConfigFilesDir>
+ <configurationDir>\${project.build.directory}/tc</configurationDir>
+ <path>/multi-config</path>
+ <port>8001</port>
+ <uriEncoding>UTF-8</uriEncoding>
+ <systemProperties>
+ <com.sun.management.jmxremote.ssl>false</com.sun.management.jmxremote.ssl>
+ </systemProperties>
+ </configuration>
+ </execution>
+ <execution>
+ <id>tomcat-shutdown</id>
+ <goals>
+ <goal>shutdown</goal>
+ </goals>
+ <phase>post-integration-test</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>${failsafe.version}</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ <version>2.5.6</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jstl</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>taglibs</groupId>
+ <artifactId>standard</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+ </dependencies>
+
+</project>
View
19 tomcat-maven-plugin-it/src/test/project-resources/tomcat-run-multi-config/src/main/tcconf/empty.txt
@@ -0,0 +1,19 @@
+ ~~ Licensed to the Apache Software Foundation (ASF) under one
+ ~~ or more contributor license agreements. See the NOTICE file
+ ~~ distributed with this work for additional information
+ ~~ regarding copyright ownership. The ASF licenses this file
+ ~~ to you under the Apache License, Version 2.0 (the
+ ~~ "License"); you may not use this file except in compliance
+ ~~ with the License. You may obtain a copy of the License at
+ ~~
+ ~~ http://www.apache.org/licenses/LICENSE-2.0
+ ~~
+ ~~ Unless required by applicable law or agreed to in writing,
+ ~~ software distributed under the License is distributed on an
+ ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~~ KIND, either express or implied. See the License for the
+ ~~ specific language governing permissions and limitations
+ ~~ under the License.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
View
40 tomcat-maven-plugin-it/src/test/project-resources/tomcat-run-multi-config/src/main/webapp/index.jsp
@@ -0,0 +1,40 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Example</title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+<body>
+<p>
+<c:choose>
+ <c:when test="${empty param.string}">
+ Not set.
+ </c:when>
+ <c:otherwise>
+ String: <b><c:out value="${param.string}" /></b>!
+ </c:otherwise>
+</c:choose>
+</p>
+</body>
+</html>
+
+
+
View
38 tomcat-maven-plugin-it/src/test/project-resources/tomcat-run-multi-config/src/main/webapp/web.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+<jsp-config>
+ <taglib>
+ <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
+ <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
+ </taglib>
+</jsp-config>
+ <!--
+ <taglib>
+ <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
+ <taglib-location>/WEB-INF/c.tld</taglib-location>
+ </taglib>
+-->
+
+</web-app>
View
30 tomcat-maven-plugin-it/src/test/project-resources/tomcat-run-multi-config/src/test/java/WaitIT.java
@@ -0,0 +1,30 @@
+import org.junit.Test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+@SuppressWarnings({"WrongPackageStatement"})
+public final class WaitIT {
+ @Test
+ public void testWait() throws Exception {
+ System.out.println("Just wait a while...");
+ Thread.sleep(${it.sleep.time});
+ }
+}
View
107 tomcat-maven-plugin-it/src/test/project-resources/usage-contextpath/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.codehaus.mojo.tomcat.it</groupId>
+ <artifactId>usage-contextpath</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <properties>
+ <pluginVersion>${project.version}</pluginVersion>
+ <maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
+ <maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
+ <project.build.sourceEncoding>${project.build.sourceEncoding}</project.build.sourceEncoding>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </properties>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>tomcat-run</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <fork>true</fork>
+ <path>/lorem</path>
+ </configuration>
+ </execution>
+ <execution>
+ <id>tomcat-shutdown</id>
+ <goals>
+ <goal>shutdown</goal>
+ </goals>
+ <phase>post-integration-test</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>${failsafe.version}</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ <version>2.5.6</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
View
29 tomcat-maven-plugin-it/src/test/project-resources/usage-contextpath/src/main/webapp/index.html
@@ -0,0 +1,29 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <title>Usage-Example: Contextpath</title>
+</head>
+<body>
+Success!
+</body>
+</html>
View
31 tomcat-maven-plugin-it/src/test/project-resources/usage-contextpath/src/test/java/WaitIT.java
@@ -0,0 +1,31 @@
+import org.junit.Test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+
+@SuppressWarnings({"WrongPackageStatement"})
+public final class WaitIT {
+ @Test
+ public void testWait() throws Exception {
+ System.out.println("Just wait a while...");
+ Thread.sleep(${it.sleep.time});
+ }
+}
View
34 tomcat-maven-plugin-it/src/test/resources/logback-test.xml
@@ -0,0 +1,34 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<configuration>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <root level="debug">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
View
176 tomcat-maven-plugin/pom.xml
@@ -0,0 +1,176 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin-parent</artifactId>
+ <version>1.2-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Tomcat Maven Plugin</name>
+ <description>The Tomcat Maven Plugin provides goals to manipulate WAR projects within the Tomcat servlet
+ container.
+ </description>
+
+ <prerequisites>
+ <maven>${mavenVersion}</maven>
+ </prerequisites>
+ <inceptionYear>2005</inceptionYear>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact-manager</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-provider-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-classworlds</artifactId>
+ </dependency>
+
+ <!-- tomcat dependencies -->
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina-ha</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tribes</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>jasper</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt.core.compiler</groupId>
+ <artifactId>ecj</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>jasper-el</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>jsp-api</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>coyote</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>dbcp</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-metadata</artifactId>
+ <version>1.5.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <targetJdk>${compileSource}</targetJdk>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <requirements>
+ <jdk>${maven.compiler.target}</jdk>
+ </requirements>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
View
275 tomcat-maven-plugin/src/main/java/org/codehaus/mojo/tomcat/AbstractCatalinaMojo.java
@@ -0,0 +1,275 @@
+package org.codehaus.mojo.tomcat;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.StringTokenizer;
+
+import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.wagon.authentication.AuthenticationInfo;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Abstract goal that provides common configuration for Catalina-based goals.
+ *
+ * @author Mark Hobson <markhobson@gmail.com>
+ * @version $Id: AbstractCatalinaMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ */
+public abstract class AbstractCatalinaMojo
+ extends AbstractI18NMojo
+{
+ // ----------------------------------------------------------------------
+ // Constants
+ // ----------------------------------------------------------------------
+
+ /**
+ * The name of this Maven plugin. Used to produce the user agent when communicating with Tomcat manager.
+ */
+ private String name = "Tomcat Maven Plugin";
+
+ /**
+ * The default username to use when authenticating with Tomcat manager.
+ */
+ private static final String DEFAULT_USERNAME = "admin";
+
+ /**
+ * The default password to use when authenticating with Tomcat manager.
+ */
+ private static final String DEFAULT_PASSWORD = "";
+
+ // ----------------------------------------------------------------------
+ // Mojo Parameters
+ // ----------------------------------------------------------------------
+
+ /**
+ * The Maven Wagon manager to use when obtaining server authentication details.
+ *
+ * @component role="org.apache.maven.artifact.manager.WagonManager"
+ * @required
+ * @readonly
+ */
+ private WagonManager wagonManager;
+
+ /**
+ * The full URL of the Tomcat manager instance to use.
+ *
+ * @parameter expression="${maven.tomcat.url}" default-value="http://localhost:8080/manager"
+ * @required
+ */
+ private URL url;
+
+ /**
+ * The server id in settings.xml to use when authenticating with Tomcat manager, or <code>null</code> to use
+ * defaults of username <code>admin</code> and no password.
+ *
+ * @parameter expression="${maven.tomcat.server}"
+ */
+ private String server;
+
+ /**
+ * The URL encoding charset to use when communicating with Tomcat manager.
+ *
+ * @parameter expression="${maven.tomcat.charset}" default-value="ISO-8859-1"
+ * @required
+ */
+ private String charset;
+
+ /**
+ * The tomcat username to use for deployment
+ *
+ * @parameter expression="${tomcat.username}"
+ * @since 1.0-alpha-2
+ */
+ private String username;
+
+ /**
+ * The password to use for deployment
+ *
+ * @parameter expression="${tomcat.password}"
+ * @since 1.0-alpha-2
+ */
+ private String password;
+
+ /**
+ * @parameter expression="${plugin.version}"
+ * @required
+ * @readonly
+ */
+ private String version;
+
+ // ----------------------------------------------------------------------
+ // Fields
+ // ----------------------------------------------------------------------