├── .asf.yaml
├── .git-blame-ignore-revs
├── .github
├── ISSUE_TEMPLATE
│ ├── BUG.yml
│ ├── FEATURE.yml
│ └── config.yml
├── release-drafter.yml
└── workflows
│ ├── dependabot.yml
│ ├── maven-verify.yml
│ ├── pr-automation.yml
│ ├── release-drafter.yml
│ └── stale.yml
├── .gitignore
├── Jenkinsfile
├── README.md
├── pom.xml
└── src
├── it
├── default
│ ├── pom.xml
│ └── src
│ │ └── test
│ │ └── verifier
│ │ └── verifications.xml
├── settings.xml
└── simple
│ ├── pom.xml
│ └── src
│ ├── main
│ └── resources
│ │ ├── file1.txt
│ │ └── file2.txt
│ └── test
│ └── verifier
│ └── verifications-test.xml
├── main
├── java
│ └── org
│ │ └── apache
│ │ └── maven
│ │ └── plugins
│ │ └── verifier
│ │ ├── ConsoleVerificationResultPrinter.java
│ │ ├── VerificationResult.java
│ │ ├── VerificationResultPrinter.java
│ │ └── VerifierMojo.java
└── mdo
│ └── verifications.mdo
├── site
├── apt
│ ├── examples
│ │ └── sample-verifications.apt
│ ├── index.apt.vm
│ ├── usage.apt.vm
│ └── using-xsd.apt
├── fml
│ └── faq.fml
├── resources
│ └── download.cgi
├── site.xml
└── xdoc
│ └── download.xml.vm
└── test
├── java
└── org
│ └── apache
│ └── maven
│ └── plugins
│ └── verifier
│ └── VerifierMojoTest.java
└── resources
├── File Exists.xml
├── FileDoesNotExist.xml
├── FileExistsInvalidContent.xml
├── FileExistsValidContent.xml
├── InexistentFile.xml
└── InexistentFileThatExists.xml
/.asf.yaml:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed to the Apache Software Foundation (ASF) under one or more
3 | # contributor license agreements. See the NOTICE file distributed with
4 | # this work for additional information regarding copyright ownership.
5 | # The ASF licenses this file to You under the Apache License, Version 2.0
6 | # (the "License"); you may not use this file except in compliance with
7 | # the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 | # see https://s.apache.org/asfyaml
18 | github:
19 | description: "Apache Maven Verifier Plugin"
20 | homepage: https://maven.apache.org/plugins/maven-verifier-plugin/
21 | labels:
22 | - java
23 | - build-management
24 | - maven-plugins
25 | - maven-verifier-plugin
26 | - maven
27 | enabled_merge_buttons:
28 | squash: true
29 | merge: false
30 | rebase: true
31 | autolink_jira:
32 | - MVERIFIER
33 | del_branch_on_merge: true
34 | features:
35 | issues: true
36 | notifications:
37 | commits: commits@maven.apache.org
38 | issues: issues@maven.apache.org
39 | pullrequests: issues@maven.apache.org
40 | jira_options: link label comment
41 |
--------------------------------------------------------------------------------
/.git-blame-ignore-revs:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed to the Apache Software Foundation (ASF) under one
3 | # or more contributor license agreements. See the NOTICE file
4 | # distributed with this work for additional information
5 | # regarding copyright ownership. The ASF licenses this file
6 | # to you under the Apache License, Version 2.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | # KIND, either express or implied. See the License for the
16 | # specific language governing permissions and limitations
17 | # under the License.
18 | #
19 |
20 | # Change maven code style
21 | 5d8ee0dbcfcae42538294e9d17f12c2d757d0fdd
22 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/BUG.yml:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed to the Apache Software Foundation (ASF) under one or more
3 | # contributor license agreements. See the NOTICE file distributed with
4 | # this work for additional information regarding copyright ownership.
5 | # The ASF licenses this file to You under the Apache License, Version 2.0
6 | # (the "License"); you may not use this file except in compliance with
7 | # the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
19 |
20 | name: Bug Report
21 | description: File a bug report
22 | labels: ["bug"]
23 |
24 | body:
25 | - type: markdown
26 | attributes:
27 | value: |
28 | Thanks for taking the time to fill out this bug report.
29 |
30 | Simple fixes in single PRs do not require issues.
31 |
32 | **Do you use the latest project version?**
33 |
34 | - type: input
35 | id: version
36 | attributes:
37 | label: Affected version
38 | validations:
39 | required: true
40 |
41 | - type: textarea
42 | id: message
43 | attributes:
44 | label: Bug description
45 | validations:
46 | required: true
47 |
48 |
49 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/FEATURE.yml:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed to the Apache Software Foundation (ASF) under one or more
3 | # contributor license agreements. See the NOTICE file distributed with
4 | # this work for additional information regarding copyright ownership.
5 | # The ASF licenses this file to You under the Apache License, Version 2.0
6 | # (the "License"); you may not use this file except in compliance with
7 | # the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
19 |
20 | name: Feature request
21 | description: File a proposal for new feature, improvement
22 | labels: ["enhancement"]
23 |
24 | body:
25 | - type: markdown
26 | attributes:
27 | value: |
28 | Thanks for taking the time to fill out this new feature, improvement proposal.
29 |
30 | - type: textarea
31 | id: message
32 | attributes:
33 | label: New feature, improvement proposal
34 | validations:
35 | required: true
36 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed to the Apache Software Foundation (ASF) under one or more
3 | # contributor license agreements. See the NOTICE file distributed with
4 | # this work for additional information regarding copyright ownership.
5 | # The ASF licenses this file to You under the Apache License, Version 2.0
6 | # (the "License"); you may not use this file except in compliance with
7 | # the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
19 |
20 | blank_issues_enabled: false
21 |
22 | contact_links:
23 |
24 | - name: Project Mailing Lists
25 | url: https://maven.apache.org/mailing-lists.html
26 | about: Please ask a question or discuss here
27 |
28 | - name: Old JIRA Issues
29 | url: https://issues.apache.org/jira/projects/MVERIFIER
30 | about: Please search old JIRA issues
31 |
--------------------------------------------------------------------------------
/.github/release-drafter.yml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | _extends: maven-gh-actions-shared
19 |
--------------------------------------------------------------------------------
/.github/workflows/dependabot.yml:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed to the Apache Software Foundation (ASF) under one or more
3 | # contributor license agreements. See the NOTICE file distributed with
4 | # this work for additional information regarding copyright ownership.
5 | # The ASF licenses this file to You under the Apache License, Version 2.0
6 | # (the "License"); you may not use this file except in compliance with
7 | # the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 | version: 2
18 | updates:
19 | - package-ecosystem: "maven"
20 | directory: "/"
21 | schedule:
22 | interval: "daily"
23 | - package-ecosystem: "github-actions"
24 | directory: "/"
25 | schedule:
26 | interval: "daily"
27 |
28 |
--------------------------------------------------------------------------------
/.github/workflows/maven-verify.yml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | name: Verify
19 |
20 | on:
21 | push:
22 | pull_request:
23 |
24 | jobs:
25 | build:
26 | name: Verify
27 | uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
28 | with:
29 | maven4-enabled: true
30 |
--------------------------------------------------------------------------------
/.github/workflows/pr-automation.yml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | name: PR Automation
19 | on:
20 | pull_request_target:
21 | types:
22 | - closed
23 |
24 | jobs:
25 | pr-automation:
26 | name: PR Automation
27 | uses: apache/maven-gh-actions-shared/.github/workflows/pr-automation.yml@v4
28 |
--------------------------------------------------------------------------------
/.github/workflows/release-drafter.yml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | name: Release Drafter
19 | on:
20 | push:
21 | branches:
22 | - master
23 | jobs:
24 | update_release_draft:
25 | uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v4
26 |
--------------------------------------------------------------------------------
/.github/workflows/stale.yml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | name: Stale
19 |
20 | on:
21 | schedule:
22 | - cron: '14 2 * * *'
23 | issue_comment:
24 | types: [ 'created' ]
25 |
26 | jobs:
27 | stale:
28 | uses: 'apache/maven-gh-actions-shared/.github/workflows/stale.yml@v4'
29 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | .project
3 | .classpath
4 | .settings/
5 | .svn/
6 | bin/
7 | # Intellij
8 | *.ipr
9 | *.iml
10 | .idea
11 | out/
12 | .DS_Store
13 | /bootstrap
14 | /dependencies.xml
15 | .java-version
16 |
--------------------------------------------------------------------------------
/Jenkinsfile:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | asfMavenTlpPlgnBuild()
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
17 | Contributing to [Apache Maven Verifier Plugin](https://maven.apache.org/plugins/maven-verifier-plugin/)
18 | ======================
19 |
20 | [][license]
21 | [](https://search.maven.org/artifact/org.apache.maven.plugins/maven-verifier-plugin)
22 | [][build]
23 | [][test-results]
24 |
25 |
26 | You have found a bug, or you have an idea for a cool new feature? Contributing
27 | code is a great way to give something back to the open source community. Before
28 | you dig right into the code, there are a few guidelines that we need
29 | contributors to follow so that we can have a chance of keeping on top of
30 | things.
31 |
32 | Getting Started
33 | ---------------
34 |
35 | + Make sure you have a [GitHub account](https://github.com/signup/free).
36 | + If you're planning to implement a new feature, it makes sense to discuss your changes
37 | on the [dev list][ml-list] first.
38 | This way you can make sure you're not wasting your time on something that isn't
39 | considered to be in Apache Maven's scope.
40 | + Submit a ticket for your issue, assuming one does not already exist.
41 | + Clearly describe the issue, including steps to reproduce when it is a bug.
42 | + Make sure you fill in the earliest version that you know has the issue.
43 | + Fork the repository on GitHub.
44 |
45 | Making and Submitting Changes
46 | --------------
47 |
48 | We accept Pull Requests via GitHub. The [developer mailing list][ml-list] is the
49 | main channel of communication for contributors.
50 | There are some guidelines which will make applying PRs easier for us:
51 | + Create a topic branch from where you want to base your work (this is usually the master branch).
52 | Push your changes to a topic branch in your fork of the repository.
53 | + Make commits of logical units.
54 | + Respect the original code style: by using the same [codestyle][code-style],
55 | patches should only highlight the actual difference, not being disturbed by any formatting issues:
56 | + Only use spaces for indentation.
57 | + Create minimal diffs - disable on save actions like reformat source code or organize imports.
58 | If you feel the source code should be reformatted, create a separate PR for this change.
59 | + Check for unnecessary whitespace with `git diff --check` before committing.
60 | + Make sure you have added the necessary tests (JUnit/IT) for your changes.
61 | + Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken.
62 | + Submit a pull request to the repository in the Apache organization.
63 |
64 | If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla].
65 |
66 | Additional Resources
67 | --------------------
68 |
69 | + [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch)
70 | + [Contributor License Agreement][cla]
71 | + [General GitHub documentation](https://help.github.com/)
72 | + [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
73 | + [Apache Maven X Account](https://x.com/ASFMavenProject)
74 | + [Apache Maven Bluesky Account](https://bsky.app/profile/maven.apache.org)
75 | + [Apache Maven Mastodon Account](https://mastodon.social/deck/@ASFMavenProject@fosstodon.org)
76 |
77 | [license]: https://www.apache.org/licenses/LICENSE-2.0
78 | [ml-list]: https://maven.apache.org/mailing-lists.html
79 | [code-style]: https://maven.apache.org/developers/conventions/code.html
80 | [cla]: https://www.apache.org/licenses/#clas
81 | [maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index
82 | [test-results]: https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-verifier-plugin/job/master/lastCompletedBuild/testReport/
83 | [build]: https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-verifier-plugin/job/master/
84 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 | 4.0.0
22 |
23 |
24 | org.apache.maven.plugins
25 | maven-plugins
26 | 44
27 |
28 |
29 | maven-verifier-plugin
30 | 3.0.0-SNAPSHOT
31 | maven-plugin
32 |
33 | Apache Maven Verifier Plugin
34 | Assists in integration testing by means of evaluating success/error conditions read from a configuration file.
35 |
36 |
37 | 3.6.3
38 |
39 |
40 |
41 | scm:git:https://gitbox.apache.org/repos/asf/maven-verifier-plugin.git
42 | scm:git:https://gitbox.apache.org/repos/asf/maven-verifier-plugin.git
43 | HEAD
44 | https://github.com/apache/maven-verifier-plugin/tree/${project.scm.tag}
45 |
46 |
47 | GitHub Issues
48 | https://github.com/apache/maven-verifier-plugin/issues
49 |
50 |
51 | Jenkins
52 | https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-verifier-plugin/
53 |
54 |
55 |
56 | apache.website
57 | scm:svn:https://svn.apache.org/repos/asf/maven/website/components/${maven.site.path}
58 |
59 |
60 |
61 |
62 | 8
63 | 3.9.9
64 | 2020-04-07T21:04:00Z
65 |
66 |
67 |
68 |
69 | org.apache.maven
70 | maven-plugin-api
71 | ${mavenVersion}
72 | provided
73 |
74 |
75 |
76 |
77 | org.apache.maven.plugin-tools
78 | maven-plugin-annotations
79 | ${version.maven-plugin-tools}
80 | provided
81 |
82 |
83 |
84 | junit
85 | junit
86 | 4.13.2
87 | test
88 |
89 |
90 | org.codehaus.plexus
91 | plexus-utils
92 |
93 |
94 | org.codehaus.plexus
95 | plexus-xml
96 |
97 |
98 |
99 |
100 |
101 |
102 | org.codehaus.modello
103 | modello-maven-plugin
104 |
105 |
106 | src/main/mdo/verifications.mdo
107 |
108 | 1.0.0
109 |
110 |
111 |
112 | generate-xsd-site
113 |
114 | xsd
115 |
116 | pre-site
117 |
118 | ${project.reporting.outputDirectory}/xsd
119 |
120 |
121 |
122 | standard
123 |
124 | java
125 | xpp3-reader
126 | xpp3-writer
127 |
128 |
129 |
130 | site-docs
131 |
132 | xdoc
133 |
134 | pre-site
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 | run-its
144 |
145 |
146 |
147 | maven-invoker-plugin
148 |
149 |
150 | install
151 |
152 |
153 |
154 |
155 | integration-test
156 |
157 | integration-test
158 | verify
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
--------------------------------------------------------------------------------
/src/it/default/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
22 |
23 | 4.0.0
24 |
25 | org.apache.maven.its.it0006
26 | maven-it-it0006
27 | 1.0-alpha-2-SNAPSHOT
28 |
29 | Maven Integration Test :: it0006
30 | Integration test for the verifier plugin.
31 |
32 |
33 | UTF-8
34 |
35 |
36 |
37 |
38 |
39 | maven-verifier-plugin
40 | @project.version@
41 |
42 |
43 |
44 | verify
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/it/default/src/test/verifier/verifications.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | src/test/verifier/verifications.xml
23 |
24 |
25 | src/test/verifier/invalidfile
26 | false
27 |
28 |
29 | pom.xml
30 | Maven.*Integration Test
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/it/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
22 |
23 |
24 |
25 | it-repo
26 |
27 | true
28 |
29 |
30 |
31 | local.central
32 | @localRepositoryUrl@
33 |
34 | true
35 |
36 |
37 | true
38 |
39 |
40 |
41 |
42 |
43 | local.central
44 | @localRepositoryUrl@
45 |
46 | true
47 |
48 |
49 | true
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/src/it/simple/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
22 |
23 | 4.0.0
24 |
25 | org.apache.maven.plugins
26 | maven-verifier-plugin-sample-simple
27 | 1.0-SNAPSHOT
28 | jar
29 |
30 | Maven Verifier Plugin Simple Sample
31 | Maven Verifier Plugin Simple Sample
32 |
33 |
34 | UTF-8
35 |
36 |
37 |
38 |
39 |
40 | org.apache.maven.plugins
41 | maven-verifier-plugin
42 | @project.version@
43 |
44 | true
45 | ${basedir}/src/test/verifier/verifications-test.xml
46 |
47 |
48 |
49 | main
50 | verify
51 |
52 | verify
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/src/it/simple/src/main/resources/file1.txt:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | This one is quite empty.
19 |
--------------------------------------------------------------------------------
/src/it/simple/src/main/resources/file2.txt:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | Lots of stuff here.... aaaabbbb that's all!!
19 |
--------------------------------------------------------------------------------
/src/it/simple/src/test/verifier/verifications-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
22 |
23 |
24 |
25 | src/main/resources/file1.txt
26 |
27 |
28 | src/main/resources/file2.txt
29 | aaaabbbb
30 |
31 |
32 | src/main/resources/file3.txt
33 | false
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/main/java/org/apache/maven/plugins/verifier/ConsoleVerificationResultPrinter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package org.apache.maven.plugins.verifier;
20 |
21 | /*
22 | * Licensed to the Apache Software Foundation (ASF) under one
23 | * or more contributor license agreements. See the NOTICE file
24 | * distributed with this work for additional information
25 | * regarding copyright ownership. The ASF licenses this file
26 | * to you under the Apache License, Version 2.0 (the
27 | * "License"); you may not use this file except in compliance
28 | * with the License. You may obtain a copy of the License at
29 | *
30 | * http://www.apache.org/licenses/LICENSE-2.0
31 | *
32 | * Unless required by applicable law or agreed to in writing,
33 | * software distributed under the License is distributed on an
34 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
35 | * KIND, either express or implied. See the License for the
36 | * specific language governing permissions and limitations
37 | * under the License.
38 | */
39 |
40 | import org.apache.maven.plugin.logging.Log;
41 | import org.apache.maven.plugins.verifier.model.File;
42 |
43 | /**
44 | *
45 | */
46 | public class ConsoleVerificationResultPrinter implements VerificationResultPrinter {
47 | private Log log;
48 |
49 | /**
50 | * @param log {@link Log}
51 | */
52 | public ConsoleVerificationResultPrinter(Log log) {
53 | this.log = log;
54 | }
55 |
56 | /**
57 | * {@inheritDoc}
58 | */
59 | public void print(VerificationResult results) {
60 | for (File file : results.getExistenceFailures()) {
61 | printMessage("File not found [" + file.getLocation() + "]");
62 | }
63 |
64 | for (File file : results.getNonExistenceFailures()) {
65 | printMessage("File should not exist [" + file.getLocation() + "]");
66 | }
67 |
68 | for (File file : results.getContentFailures()) {
69 | printMessage("File [" + file.getLocation() + "] does not match regexp [" + file.getContains() + "]");
70 | }
71 | }
72 |
73 | private void printMessage(String message) {
74 | this.log.error("[Verifier] " + message);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/org/apache/maven/plugins/verifier/VerificationResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package org.apache.maven.plugins.verifier;
20 |
21 | /*
22 | * Licensed to the Apache Software Foundation (ASF) under one
23 | * or more contributor license agreements. See the NOTICE file
24 | * distributed with this work for additional information
25 | * regarding copyright ownership. The ASF licenses this file
26 | * to you under the Apache License, Version 2.0 (the
27 | * "License"); you may not use this file except in compliance
28 | * with the License. You may obtain a copy of the License at
29 | *
30 | * http://www.apache.org/licenses/LICENSE-2.0
31 | *
32 | * Unless required by applicable law or agreed to in writing,
33 | * software distributed under the License is distributed on an
34 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
35 | * KIND, either express or implied. See the License for the
36 | * specific language governing permissions and limitations
37 | * under the License.
38 | */
39 |
40 | import java.util.ArrayList;
41 | import java.util.List;
42 |
43 | import org.apache.maven.plugins.verifier.model.File;
44 |
45 | /**
46 | *
47 | */
48 | public class VerificationResult {
49 | private List existenceFailures = new ArrayList<>();
50 |
51 | private List nonExistenceFailures = new ArrayList<>();
52 |
53 | private List contentFailures = new ArrayList<>();
54 |
55 | /**
56 | * @param file {@link File}
57 | */
58 | public void addExistenceFailure(File file) {
59 | existenceFailures.add(file);
60 | }
61 |
62 | /**
63 | * Added non existence failure.
64 | *
65 | * @param file {@link File}
66 | */
67 | public void addNonExistenceFailure(File file) {
68 | nonExistenceFailures.add(file);
69 | }
70 |
71 | /**
72 | * Add content failure.
73 | *
74 | * @param file {@link File}
75 | */
76 | public void addContentFailure(File file) {
77 | contentFailures.add(file);
78 | }
79 |
80 | /**
81 | * @return {@link #existenceFailures}
82 | */
83 | public List getExistenceFailures() {
84 | return existenceFailures;
85 | }
86 |
87 | /**
88 | * @return {@link #nonExistenceFailures}
89 | */
90 | public List getNonExistenceFailures() {
91 | return nonExistenceFailures;
92 | }
93 |
94 | /**
95 | * @return {@link #contentFailures}
96 | */
97 | public List getContentFailures() {
98 | return contentFailures;
99 | }
100 |
101 | /**
102 | * @return true if a failures exists false otherwise.
103 | */
104 | public boolean hasFailures() {
105 | return !getExistenceFailures().isEmpty()
106 | || !getNonExistenceFailures().isEmpty()
107 | || !getContentFailures().isEmpty();
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/src/main/java/org/apache/maven/plugins/verifier/VerificationResultPrinter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package org.apache.maven.plugins.verifier;
20 |
21 | /*
22 | * Licensed to the Apache Software Foundation (ASF) under one
23 | * or more contributor license agreements. See the NOTICE file
24 | * distributed with this work for additional information
25 | * regarding copyright ownership. The ASF licenses this file
26 | * to you under the Apache License, Version 2.0 (the
27 | * "License"); you may not use this file except in compliance
28 | * with the License. You may obtain a copy of the License at
29 | *
30 | * http://www.apache.org/licenses/LICENSE-2.0
31 | *
32 | * Unless required by applicable law or agreed to in writing,
33 | * software distributed under the License is distributed on an
34 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
35 | * KIND, either express or implied. See the License for the
36 | * specific language governing permissions and limitations
37 | * under the License.
38 | */
39 |
40 | /**
41 | *
42 | */
43 | public interface VerificationResultPrinter {
44 | /**
45 | * @param result {@link VerificationResult}
46 | */
47 | void print(VerificationResult result);
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/org/apache/maven/plugins/verifier/VerifierMojo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package org.apache.maven.plugins.verifier;
20 |
21 | /*
22 | * Licensed to the Apache Software Foundation (ASF) under one
23 | * or more contributor license agreements. See the NOTICE file
24 | * distributed with this work for additional information
25 | * regarding copyright ownership. The ASF licenses this file
26 | * to you under the Apache License, Version 2.0 (the
27 | * "License"); you may not use this file except in compliance
28 | * with the License. You may obtain a copy of the License at
29 | *
30 | * http://www.apache.org/licenses/LICENSE-2.0
31 | *
32 | * Unless required by applicable law or agreed to in writing,
33 | * software distributed under the License is distributed on an
34 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
35 | * KIND, either express or implied. See the License for the
36 | * specific language governing permissions and limitations
37 | * under the License.
38 | */
39 |
40 | import java.io.File;
41 | import java.io.FileReader;
42 | import java.io.IOException;
43 | import java.io.Reader;
44 | import java.util.regex.Matcher;
45 | import java.util.regex.Pattern;
46 |
47 | import org.apache.maven.plugin.AbstractMojo;
48 | import org.apache.maven.plugin.MojoExecutionException;
49 | import org.apache.maven.plugins.annotations.LifecyclePhase;
50 | import org.apache.maven.plugins.annotations.Mojo;
51 | import org.apache.maven.plugins.annotations.Parameter;
52 | import org.apache.maven.plugins.verifier.model.Verifications;
53 | import org.apache.maven.plugins.verifier.model.io.xpp3.VerificationsXpp3Reader;
54 | import org.codehaus.plexus.util.FileUtils;
55 | import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
56 |
57 | /**
58 | * Verifies the existence or non-existence of files/directories and optionally checks file content against a regular
59 | * expression.
60 | *
61 | * @author Vincent Massol
62 | */
63 | @Mojo(name = "verify", defaultPhase = LifecyclePhase.INTEGRATION_TEST)
64 | public class VerifierMojo extends AbstractMojo {
65 | /**
66 | * Project base directory (prepended to relative file paths).
67 | */
68 | @Parameter(property = "basedir", required = true)
69 | private File basedir;
70 |
71 | /**
72 | * The file containing the verifications to perform.
73 | */
74 | @Parameter(
75 | property = "verifier.verificationFile",
76 | defaultValue = "${basedir}/src/test/verifier/verifications.xml",
77 | required = true)
78 | private File verificationFile;
79 |
80 | /**
81 | * Whether the build will fail on verification errors.
82 | */
83 | @Parameter(property = "verifier.failOnError", defaultValue = "true", required = true)
84 | private boolean failOnError;
85 |
86 | private VerificationResultPrinter resultPrinter = new ConsoleVerificationResultPrinter(getLog());
87 |
88 | /**
89 | * {@inheritDoc}
90 | */
91 | public void execute() throws MojoExecutionException {
92 | VerificationResult results = verify();
93 | resultPrinter.print(results);
94 |
95 | // Fail the build if there are errors
96 | if (this.failOnError && results.hasFailures()) {
97 | throw new MojoExecutionException("There are test failures");
98 | }
99 | }
100 |
101 | /**
102 | * @param file the file path of the file to check (can be relative or absolute). If relative
103 | * the project's basedir will be prefixed.
104 | * @return the absolute file path of the file to check
105 | */
106 | protected File getAbsoluteFileToCheck(File file) {
107 | File result = file;
108 | if (!file.isAbsolute()) {
109 | result = new File(basedir, file.getPath());
110 | }
111 | return result;
112 | }
113 |
114 | private VerificationResult verify() throws MojoExecutionException {
115 | VerificationResult results = new VerificationResult();
116 |
117 | try (Reader reader = new FileReader(verificationFile)) {
118 | VerificationsXpp3Reader xppReader = new VerificationsXpp3Reader();
119 | Verifications verifications = xppReader.read(reader);
120 |
121 | for (org.apache.maven.plugins.verifier.model.File file : verifications.getFiles()) {
122 | // Transform the file to check into an absolute path prefixing the basedir if
123 | // the location is relative
124 | if (file.getLocation() != null) {
125 | file.setLocation(
126 | getAbsoluteFileToCheck(new File(file.getLocation())).getPath());
127 | verifyFile(file, results);
128 | } else {
129 | throw new MojoExecutionException("Missing element");
130 | }
131 | }
132 | } catch (XmlPullParserException | IOException e) {
133 | throw new MojoExecutionException("Error while verifying files", e);
134 | }
135 |
136 | return results;
137 | }
138 |
139 | private boolean verifyFile(org.apache.maven.plugins.verifier.model.File fileCheck, VerificationResult results)
140 | throws IOException {
141 | boolean result;
142 |
143 | result = verifyFileExistence(fileCheck, results);
144 | if (result && fileCheck.getContains() != null) {
145 | result = result && verifyFileContent(fileCheck, results);
146 | }
147 |
148 | return result;
149 | }
150 |
151 | private boolean verifyFileContent(
152 | org.apache.maven.plugins.verifier.model.File fileCheck, VerificationResult results) throws IOException {
153 | boolean result = false;
154 |
155 | getLog().debug("Verifying contents of " + fileCheck.getLocation());
156 |
157 | Pattern pattern = Pattern.compile(fileCheck.getContains());
158 |
159 | // Note: Very inefficient way as we load the whole file in memory. If you have a better
160 | // idea, please submit it!
161 | Matcher matcher = pattern.matcher(FileUtils.fileRead(new File(fileCheck.getLocation())));
162 |
163 | if (matcher.find()) {
164 | result = true;
165 | } else {
166 | results.addContentFailure(fileCheck);
167 | }
168 |
169 | return result;
170 | }
171 |
172 | private boolean verifyFileExistence(
173 | org.apache.maven.plugins.verifier.model.File fileCheck, VerificationResult results) {
174 | boolean result;
175 |
176 | File physicalFile = new File(fileCheck.getLocation());
177 | if (fileCheck.isExists()) {
178 | getLog().debug("Verifying existence of " + physicalFile);
179 | result = physicalFile.exists();
180 | if (!result) {
181 | results.addExistenceFailure(fileCheck);
182 | }
183 | } else {
184 | getLog().debug("Verifying absence of " + physicalFile);
185 | result = !physicalFile.exists();
186 | if (!result) {
187 | results.addNonExistenceFailure(fileCheck);
188 | }
189 | }
190 |
191 | return result;
192 | }
193 |
194 | /**
195 | * @param theBasedir Set the base directory.
196 | */
197 | public void setBaseDir(File theBasedir) {
198 | this.basedir = theBasedir;
199 | }
200 |
201 | /**
202 | * @param file Set the file for verification.
203 | */
204 | public void setVerificationFile(File file) {
205 | this.verificationFile = file;
206 | }
207 |
208 | /**
209 | * @param printer The verification result printer {@link VerificationResultPrinter}
210 | */
211 | public void setVerificationResultPrinter(VerificationResultPrinter printer) {
212 | this.resultPrinter = printer;
213 | }
214 |
215 | /**
216 | * @param failOnError true to fail on error false otherwise.
217 | */
218 | public void setFailOnError(boolean failOnError) {
219 | this.failOnError = failOnError;
220 | }
221 | }
222 |
--------------------------------------------------------------------------------
/src/main/mdo/verifications.mdo:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 | verifications
26 | Verifications
27 |
32 |
33 |
34 | package
35 | org.apache.maven.plugins.verifier.model
36 |
37 |
38 |
39 |
40 | Verifications
41 | 1.0.0
42 | Root element of the verifications file.
43 |
44 |
45 | files
46 | 1.0.0
47 |
50 |
51 | File
52 | *
53 |
54 |
55 |
56 |
57 |
58 | File
59 | 1.0.0
60 |
61 |
62 | location
63 | 1.0.0
64 | true
65 |
66 | String
67 |
68 |
69 | contains
70 | 1.0.0
71 |
72 | false
73 | String
74 |
75 |
76 | exists
77 | 1.0.0
78 | true the plugin checks that the
80 | file or directory exists. When set to false
it checks
81 | that the file or directory does not exist.
82 | ]]>
83 | true
84 | boolean
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/src/site/apt/examples/sample-verifications.apt:
--------------------------------------------------------------------------------
1 | ------
2 | Sample Verifications
3 | ------
4 | Denis Cabasson
5 | ------
6 | 2010-01-18
7 | ------
8 |
9 | ~~ Licensed to the Apache Software Foundation (ASF) under one
10 | ~~ or more contributor license agreements. See the NOTICE file
11 | ~~ distributed with this work for additional information
12 | ~~ regarding copyright ownership. The ASF licenses this file
13 | ~~ to you under the Apache License, Version 2.0 (the
14 | ~~ "License"); you may not use this file except in compliance
15 | ~~ with the License. You may obtain a copy of the License at
16 | ~~
17 | ~~ http://www.apache.org/licenses/LICENSE-2.0
18 | ~~
19 | ~~ Unless required by applicable law or agreed to in writing,
20 | ~~ software distributed under the License is distributed on an
21 | ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22 | ~~ KIND, either express or implied. See the License for the
23 | ~~ specific language governing permissions and limitations
24 | ~~ under the License.
25 |
26 | ~~ NOTE: For help with the syntax of this file, see:
27 | ~~ http://maven.apache.org/doxia/references/apt-format.html
28 |
29 | Sample Verifications
30 |
31 | Here is an example of what a <<>> file can look like:
32 |
33 | +--------
34 |
37 |
38 |
39 | src/main/resources/file1.txt
40 |
41 |
42 | src/main/resources/file2.txt
43 | aaaabbbb
44 |
45 |
46 | src/main/resources/file3.txt
47 | false
48 |
49 |
50 |
51 | +---------
52 |
53 | This file:
54 |
55 | * checks that the file <<>> is present.
56 |
57 | * checks that the file <<>> is present and matches the regular expression .
58 |
59 | * checks that the file <<>> is <> present.
60 |
--------------------------------------------------------------------------------
/src/site/apt/index.apt.vm:
--------------------------------------------------------------------------------
1 | ------
2 | Introduction
3 | ------
4 | Denis Cabasson
5 | ------
6 | 2013-07-22
7 | ------
8 |
9 | ~~ Licensed to the Apache Software Foundation (ASF) under one
10 | ~~ or more contributor license agreements. See the NOTICE file
11 | ~~ distributed with this work for additional information
12 | ~~ regarding copyright ownership. The ASF licenses this file
13 | ~~ to you under the Apache License, Version 2.0 (the
14 | ~~ "License"); you may not use this file except in compliance
15 | ~~ with the License. You may obtain a copy of the License at
16 | ~~
17 | ~~ http://www.apache.org/licenses/LICENSE-2.0
18 | ~~
19 | ~~ Unless required by applicable law or agreed to in writing,
20 | ~~ software distributed under the License is distributed on an
21 | ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22 | ~~ KIND, either express or implied. See the License for the
23 | ~~ specific language governing permissions and limitations
24 | ~~ under the License.
25 |
26 | ~~ NOTE: For help with the syntax of this file, see:
27 | ~~ http://maven.apache.org/doxia/references/apt-format.html
28 |
29 | ${project.name}
30 |
31 | Useful for integration tests - verifies the existence of certain conditions.
32 |
33 | * Goals Overview
34 |
35 | * {{{./verify-mojo.html}verifier:verify}} Verifies the existence or non-existence of files/directories and optionally checks file content against a regular expression.
36 |
37 | * Usage
38 |
39 | General instructions on how to use the Verifier Plugin can be found on the {{{./usage.html}usage page}}. Some more
40 | specific use cases are described in the examples given below. Last but not least, users occasionally contribute
41 | additional examples, tips or errata to the
42 | {{{http://docs.codehaus.org/display/MAVENUSER/Verifier+Plugin}plugin's wiki page}}.
43 |
44 | In case you still have questions regarding the plugin's usage, please have a look at the {{{./faq.html}FAQ}} and feel
45 | free to contact the {{{./mailing-lists.html}user mailing list}}. The posts to the mailing list are archived and could
46 | already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching
47 | the {{{./mailing-lists.html}mail archive}}.
48 |
49 | If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our
50 | {{{./issue-management.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your
51 | concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason,
52 | entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated.
53 | Of course, patches are welcome, too. Contributors can check out the project from our
54 | {{{./scm.html}source repository}} and will find supplementary information in the
55 | {{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}.
56 |
57 | * Examples
58 |
59 | To provide you with better understanding on some usages of the Verifier Plugin,
60 | you can take a look into the following examples:
61 |
62 | * {{{./examples/sample-verifications.html}Sample Verifications}}
63 |
64 | []
65 |
--------------------------------------------------------------------------------
/src/site/apt/usage.apt.vm:
--------------------------------------------------------------------------------
1 | ------
2 | Usage
3 | ------
4 | Denis Cabasson
5 | ------
6 | 2010-01-18
7 | ------
8 |
9 | ~~ Licensed to the Apache Software Foundation (ASF) under one
10 | ~~ or more contributor license agreements. See the NOTICE file
11 | ~~ distributed with this work for additional information
12 | ~~ regarding copyright ownership. The ASF licenses this file
13 | ~~ to you under the Apache License, Version 2.0 (the
14 | ~~ "License"); you may not use this file except in compliance
15 | ~~ with the License. You may obtain a copy of the License at
16 | ~~
17 | ~~ http://www.apache.org/licenses/LICENSE-2.0
18 | ~~
19 | ~~ Unless required by applicable law or agreed to in writing,
20 | ~~ software distributed under the License is distributed on an
21 | ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22 | ~~ KIND, either express or implied. See the License for the
23 | ~~ specific language governing permissions and limitations
24 | ~~ under the License.
25 |
26 | ~~ NOTE: For help with the syntax of this file, see:
27 | ~~ http://maven.apache.org/doxia/references/apt-format.html
28 |
29 | Usage
30 |
31 | To verify file system resources during your build, add the Verifier Plugin in
32 | your <<>> under the <<>> section. You will also need to
33 | create a {{{./verifications.html}<<>>}} file that contains
34 | the verification rules. Add the path to that file to the
35 | <<>> configuration element.
36 |
37 | +--------
38 |
39 | [...]
40 |
41 |
42 |
43 | org.apache.maven.plugins
44 | maven-verifier-plugin
45 | ${project.version}
46 |
47 | src/test/verifier/verifications-test.xml
48 |
49 |
50 |
51 | main
52 | verify
53 |
54 | verify
55 |
56 |
57 |
58 |
59 |
60 |
61 | [...]
62 | +---------
63 |
64 | The Verifier Plugin will fail your build if the verification rules found in
65 | the <<>> fails. If you do not want the Verifier Plugin to
66 | fail your build you can set the configuration element <<<\>>>
67 | to <<>>.
68 |
69 | For a sample verifications file, see {{{./examples/sample-verifications.html}Sample Verifications}}.
70 |
--------------------------------------------------------------------------------
/src/site/apt/using-xsd.apt:
--------------------------------------------------------------------------------
1 | -----
2 | Using the XML Schema Verifications 1.0.0
3 | -----
4 | Dennis Lundberg
5 | ------
6 | 2010-01-18
7 | ------
8 |
9 | ~~ Licensed to the Apache Software Foundation (ASF) under one
10 | ~~ or more contributor license agreements. See the NOTICE file
11 | ~~ distributed with this work for additional information
12 | ~~ regarding copyright ownership. The ASF licenses this file
13 | ~~ to you under the Apache License, Version 2.0 (the
14 | ~~ "License"); you may not use this file except in compliance
15 | ~~ with the License. You may obtain a copy of the License at
16 | ~~
17 | ~~ http://www.apache.org/licenses/LICENSE-2.0
18 | ~~
19 | ~~ Unless required by applicable law or agreed to in writing,
20 | ~~ software distributed under the License is distributed on an
21 | ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22 | ~~ KIND, either express or implied. See the License for the
23 | ~~ specific language governing permissions and limitations
24 | ~~ under the License.
25 |
26 | ~~ NOTE: For help with the syntax of this file, see:
27 | ~~ http://maven.apache.org/doxia/references/apt-format.html
28 |
29 | Using the XML Schema Verifications 1.0.0
30 |
31 | The Verifications XSD is located {{{http://maven.apache.org/xsd/verifications-1.0.0.xsd}here}}.
32 |
33 | Your favorite IDE probably supports validation and/or syntax highlighting for
34 | XML files by using XSD schemas. For this to work you need to specify the
35 | schema in your <<>> file:
36 |
37 | +-----+
38 |
41 | ...
42 |
43 | +-----+
44 |
--------------------------------------------------------------------------------
/src/site/fml/faq.fml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
22 |
23 |
27 |
28 |
29 | Can it verify other things like URLs?
30 |
31 |
32 | No.
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/site/resources/download.cgi:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Licensed to the Apache Software Foundation (ASF) under one
4 | # or more contributor license agreements. See the NOTICE file
5 | # distributed with this work for additional information
6 | # regarding copyright ownership. The ASF licenses this file
7 | # to you under the Apache License, Version 2.0 (the
8 | # "License"); you may not use this file except in compliance
9 | # with the License. You may obtain a copy of the License at
10 | #
11 | # http://www.apache.org/licenses/LICENSE-2.0
12 | #
13 | # Unless required by applicable law or agreed to in writing,
14 | # software distributed under the License is distributed on an
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | # KIND, either express or implied. See the License for the
17 | # specific language governing permissions and limitations
18 | # under the License.
19 | #
20 | # Just call the standard mirrors.cgi script. It will use download.html
21 | # as the input template.
22 | exec /www/www.apache.org/dyn/mirrors/mirrors.cgi $*
--------------------------------------------------------------------------------
/src/site/site.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
22 |
25 |
26 |
36 |
39 |
40 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/site/xdoc/download.xml.vm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
22 |
23 |
24 | Download ${project.name} Source
25 |
26 |
27 |
28 |
29 | ${project.name} ${project.version} is distributed in source format. Use a source archive if you intend to build
30 | ${project.name} yourself. Otherwise, simply use the ready-made binary artifacts from central repository.
31 |
32 | You will be prompted for a mirror - if the file is not found on yours, please be patient, as it may take 24
33 | hours to reach all mirrors.
34 |
35 | In order to guard against corrupted downloads/installations, it is highly recommended to
36 | verify the signature
37 | of the release bundles against the public KEYS used by the Apache Maven
38 | developers.
39 |
40 | ${project.name} is distributed under the Apache License, version 2.0.
41 |
42 | We strongly encourage our users to configure a Maven repository mirror closer to their location, please read How to Use Mirrors for Repositories.
43 |
44 |
45 |
46 |
47 |
48 | [if-any logo]
49 |
50 |
52 |
53 | [end]
54 | The currently selected mirror is
55 | [preferred].
56 | If you encounter a problem with this mirror,
57 | please select another mirror.
58 | If all mirrors are failing, there are
59 | backup
60 | mirrors
61 | (at the end of the mirrors list) that should be available.
62 |
63 |
64 |
85 |
86 |
87 | You may also consult the
88 | complete list of
89 | mirrors.
90 |
91 |
92 |
93 |
94 |
95 |
96 | This is the current stable version of ${project.name}.
97 |
98 |
116 |
117 |
118 |
119 |
120 | Older non-recommended releases can be found on our archive site.
121 |
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/src/test/java/org/apache/maven/plugins/verifier/VerifierMojoTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package org.apache.maven.plugins.verifier;
20 |
21 | /*
22 | * Licensed to the Apache Software Foundation (ASF) under one
23 | * or more contributor license agreements. See the NOTICE file
24 | * distributed with this work for additional information
25 | * regarding copyright ownership. The ASF licenses this file
26 | * to you under the Apache License, Version 2.0 (the
27 | * "License"); you may not use this file except in compliance
28 | * with the License. You may obtain a copy of the License at
29 | *
30 | * http://www.apache.org/licenses/LICENSE-2.0
31 | *
32 | * Unless required by applicable law or agreed to in writing,
33 | * software distributed under the License is distributed on an
34 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
35 | * KIND, either express or implied. See the License for the
36 | * specific language governing permissions and limitations
37 | * under the License.
38 | */
39 |
40 | import java.io.File;
41 | import java.io.UnsupportedEncodingException;
42 | import java.net.URLDecoder;
43 | import java.nio.charset.StandardCharsets;
44 |
45 | import org.apache.maven.plugin.MojoExecutionException;
46 | import org.junit.Test;
47 |
48 | import static org.junit.Assert.assertEquals;
49 | import static org.junit.Assert.assertTrue;
50 | import static org.junit.Assert.fail;
51 |
52 | public class VerifierMojoTest {
53 | private File getResourceFile(String name) throws UnsupportedEncodingException {
54 | String file = getClass().getResource(name).getFile();
55 | String decode = URLDecoder.decode(
56 | file, StandardCharsets.UTF_8.toString()); // necessary for JDK 1.5+, where spaces are escaped to %20
57 | return new File(decode);
58 | }
59 |
60 | @Test
61 | public void testPrefixWithBaseDir() {
62 | VerifierMojo mojo = new VerifierMojo();
63 | mojo.setBaseDir(new File("c:/some/path"));
64 |
65 | File result = mojo.getAbsoluteFileToCheck(new File("target/dummy.txt"));
66 |
67 | File expectedResult = new File("c:/some/path/target/dummy.txt");
68 | assertEquals(expectedResult.getPath(), result.getPath());
69 | }
70 |
71 | @Test
72 | public void testDoNotPrefixWhenAbsolutePath() {
73 | VerifierMojo mojo = new VerifierMojo();
74 | mojo.setBaseDir(new File("/some/path").getAbsoluteFile());
75 |
76 | File absoluteFile = new File("/project/target/dummy.txt").getAbsoluteFile();
77 | File result = mojo.getAbsoluteFileToCheck(absoluteFile);
78 |
79 | assertEquals(absoluteFile.getPath(), result.getPath());
80 | }
81 |
82 | @Test
83 | public void testCheckFileThatDoesNotExist() throws Exception {
84 | VerifierMojo mojo = new VerifierMojo();
85 | File file = getResourceFile("/FileDoesNotExist.xml");
86 | mojo.setBaseDir(new File("c:/some/path"));
87 | mojo.setVerificationFile(file);
88 | mojo.setFailOnError(true);
89 | mojo.setVerificationResultPrinter(new VerificationResultPrinter() {
90 | public void print(VerificationResult result) {
91 | assertEquals(1, result.getExistenceFailures().size());
92 | assertEquals(0, result.getNonExistenceFailures().size());
93 | assertEquals(0, result.getContentFailures().size());
94 | }
95 | });
96 |
97 | try {
98 | mojo.execute();
99 | fail("Should have thrown an exception");
100 | } catch (MojoExecutionException expected) {
101 | assertTrue(true);
102 | }
103 | }
104 |
105 | @Test
106 | public void testCheckFileThatExists() throws Exception {
107 | VerifierMojo mojo = new VerifierMojo();
108 | File file = getResourceFile("/File Exists.xml");
109 | mojo.setBaseDir(file.getParentFile());
110 | mojo.setVerificationFile(file);
111 | mojo.setFailOnError(true);
112 | mojo.setVerificationResultPrinter(new VerificationResultPrinter() {
113 | public void print(VerificationResult result) {
114 | assertEquals(0, result.getExistenceFailures().size());
115 | assertEquals(0, result.getNonExistenceFailures().size());
116 | assertEquals(0, result.getContentFailures().size());
117 | }
118 | });
119 |
120 | mojo.execute();
121 | }
122 |
123 | @Test
124 | public void testCheckForInexistentFile() throws Exception {
125 | VerifierMojo mojo = new VerifierMojo();
126 | File file = getResourceFile("/InexistentFile.xml");
127 | mojo.setBaseDir(new File("c:/some/path"));
128 | mojo.setVerificationFile(file);
129 | mojo.setVerificationResultPrinter(new VerificationResultPrinter() {
130 | public void print(VerificationResult result) {
131 | assertEquals(0, result.getExistenceFailures().size());
132 | assertEquals(0, result.getNonExistenceFailures().size());
133 | assertEquals(0, result.getContentFailures().size());
134 | }
135 | });
136 |
137 | mojo.execute();
138 | }
139 |
140 | @Test
141 | public void testCheckForInexistentFileThatExists() throws Exception {
142 | VerifierMojo mojo = new VerifierMojo();
143 | File file = getResourceFile("/InexistentFileThatExists.xml");
144 | mojo.setBaseDir(file.getParentFile());
145 | mojo.setVerificationFile(file);
146 | mojo.setFailOnError(true);
147 | mojo.setVerificationResultPrinter(new VerificationResultPrinter() {
148 | public void print(VerificationResult result) {
149 | assertEquals(0, result.getExistenceFailures().size());
150 | assertEquals(1, result.getNonExistenceFailures().size());
151 | assertEquals(0, result.getContentFailures().size());
152 | }
153 | });
154 |
155 | try {
156 | mojo.execute();
157 | fail("Should have thrown an exception");
158 | } catch (MojoExecutionException expected) {
159 | assertTrue(true);
160 | }
161 | }
162 |
163 | @Test
164 | public void testCheckFileForContent() throws Exception {
165 | VerifierMojo mojo = new VerifierMojo();
166 | File file = getResourceFile("/FileExistsValidContent.xml");
167 | mojo.setBaseDir(file.getParentFile());
168 | mojo.setVerificationFile(file);
169 | mojo.setVerificationResultPrinter(new VerificationResultPrinter() {
170 | public void print(VerificationResult result) {
171 | assertEquals(0, result.getExistenceFailures().size());
172 | assertEquals(0, result.getNonExistenceFailures().size());
173 | assertEquals(0, result.getContentFailures().size());
174 | }
175 | });
176 |
177 | mojo.execute();
178 | }
179 |
180 | @Test
181 | public void testCheckFileForInvalidContent() throws Exception {
182 | VerifierMojo mojo = new VerifierMojo();
183 | File file = getResourceFile("/FileExistsInvalidContent.xml");
184 | mojo.setBaseDir(file.getParentFile());
185 | mojo.setVerificationFile(file);
186 | mojo.setFailOnError(true);
187 | mojo.setVerificationResultPrinter(new VerificationResultPrinter() {
188 | public void print(VerificationResult result) {
189 | assertEquals(0, result.getExistenceFailures().size());
190 | assertEquals(0, result.getNonExistenceFailures().size());
191 | assertEquals(1, result.getContentFailures().size());
192 | }
193 | });
194 |
195 | try {
196 | mojo.execute();
197 | fail("Should have thrown an exception");
198 | } catch (MojoExecutionException expected) {
199 | assertTrue(true);
200 | }
201 | }
202 | }
203 |
--------------------------------------------------------------------------------
/src/test/resources/File Exists.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 | File Exists.xml
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/test/resources/FileDoesNotExist.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 | src/test/resources/Dummy.xml
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/test/resources/FileExistsInvalidContent.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 | FileExistsValidContent.xml
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/test/resources/FileExistsValidContent.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 | FileExistsValidContent.xml
24 | FileExists]]>
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/test/resources/InexistentFile.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 | src/test/resources/Dummy.xml
24 | false
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/test/resources/InexistentFileThatExists.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 | InexistentFileThatExists.xml
24 | false
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------