[Git][java-team/maven-ejb-plugin][upstream] New upstream version 3.3.0
Emmanuel Bourg (@ebourg)
gitlab at salsa.debian.org
Thu Oct 29 11:39:51 GMT 2026
Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / maven-ejb-plugin
Commits:
2474c70b by Emmanuel Bourg at 2026-10-29T12:21:34+01:00
New upstream version 3.3.0
- - - - -
29 changed files:
- .asf.yaml
- + .github/ISSUE_TEMPLATE/BUG.yml
- + .github/ISSUE_TEMPLATE/FEATURE.yml
- + .github/ISSUE_TEMPLATE/config.yml
- + .github/dependabot.yml
- + .github/release-drafter.yml
- .github/workflows/maven-verify.yml
- + .github/workflows/pr-automation.yml
- + .github/workflows/release-drafter.yml
- + .github/workflows/stale.yml
- + LICENSE
- README.md
- pom.xml
- src/it/mejb-34-filtered/verify.bsh → src/it/mejb-34-filtered/verify.groovy
- src/it/mejb-34-not-filtered/verify.bsh → src/it/mejb-34-not-filtered/verify.groovy
- src/it/mejb-93/verify.groovy
- − src/main/filtered-resources/META-INF/plexus/components.xml
- src/main/java/org/apache/maven/plugins/ejb/EjbHelper.java
- src/main/java/org/apache/maven/plugins/ejb/EjbMojo.java
- src/main/java/org/apache/maven/plugins/ejb/IncludesExcludes.java
- src/site/site.xml
- src/test/java/org/apache/maven/plugins/ejb/EjbHelperTest.java
- src/test/java/org/apache/maven/plugins/ejb/EjbMojoTest.java
- src/test/java/org/apache/maven/plugins/ejb/IncludesExcludesTest.java
- src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectBasicStub.java
- src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectBuildStub.java
- src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectResourcesStub.java
- src/test/java/org/apache/maven/plugins/ejb/stub/ModelStub.java
- src/test/java/org/apache/maven/plugins/ejb/utils/JarContentChecker.java
Changes:
=====================================
.asf.yaml
=====================================
@@ -24,3 +24,19 @@ github:
- maven-plugins
- maven-ejb-plugin
- maven
+ enabled_merge_buttons:
+ squash: true
+ merge: false
+ rebase: true
+ autolink_jira:
+ - MEJB
+ protected_branches:
+ master: {}
+ pull_requests:
+ del_branch_on_merge: true
+ features:
+ issues: true
+notifications:
+ commits: commits at maven.apache.org
+ issues: issues at maven.apache.org
+ pullrequests: issues at maven.apache.org
=====================================
.github/ISSUE_TEMPLATE/BUG.yml
=====================================
@@ -0,0 +1,48 @@
+#
+# 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.
+#
+
+# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
+
+name: Bug Report
+description: File a bug report
+labels: ["bug"]
+
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Thanks for taking the time to fill out this bug report.
+
+ Simple fixes in single PRs do not require issues.
+
+ **Do you use the latest project version?**
+
+ - type: input
+ id: version
+ attributes:
+ label: Affected version
+ validations:
+ required: true
+
+ - type: textarea
+ id: massage
+ attributes:
+ label: Bug description
+ validations:
+ required: true
+
+
=====================================
.github/ISSUE_TEMPLATE/FEATURE.yml
=====================================
@@ -0,0 +1,35 @@
+#
+# 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.
+#
+
+# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
+
+name: Feature request
+description: File a proposal for new feature, improvement
+labels: ["enhancement"]
+
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Thanks for taking the time to fill out this new feature, improvement proposal.
+
+ - type: textarea
+ id: massage
+ attributes:
+ label: New feature, improvement proposal
+ validations:
+ required: true
=====================================
.github/ISSUE_TEMPLATE/config.yml
=====================================
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+
+# 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
+
+blank_issues_enabled: false
+
+contact_links:
+
+ - name: Project Mailing Lists
+ url: https://maven.apache.org/mailing-lists.html
+ about: Please ask a question or discuss here
+
+ - name: Old JIRA Issues
+ url: https://issues.apache.org/jira/projects/MEJB
+ about: Please search old JIRA issues
=====================================
.github/dependabot.yml
=====================================
@@ -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.
+#
+# Please see the documentation for all configuration options:
+# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+#
+version: 2
+updates:
+ - package-ecosystem: "maven"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
=====================================
.github/release-drafter.yml
=====================================
@@ -0,0 +1,18 @@
+# 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.
+
+_extends: maven-gh-actions-shared
=====================================
.github/workflows/maven-verify.yml
=====================================
@@ -24,4 +24,4 @@ on:
jobs:
build:
name: Verify
- uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml at v2
+ uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml at v4
=====================================
.github/workflows/pr-automation.yml
=====================================
@@ -0,0 +1,27 @@
+# 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.
+
+name: PR Automation
+on:
+ pull_request_target:
+ types:
+ - closed
+
+jobs:
+ pr-automation:
+ name: PR Automation
+ uses: apache/maven-gh-actions-shared/.github/workflows/pr-automation.yml at v4
=====================================
.github/workflows/release-drafter.yml
=====================================
@@ -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.
+
+name: Release Drafter
+on:
+ push:
+ branches:
+ - master
+ workflow_dispatch:
+
+jobs:
+ update_release_draft:
+ uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml at v4
=====================================
.github/workflows/stale.yml
=====================================
@@ -0,0 +1,28 @@
+# 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.
+
+name: Stale
+
+on:
+ schedule:
+ - cron: '23 3 * * *'
+ issue_comment:
+ types: [ 'created' ]
+
+jobs:
+ stale:
+ uses: 'apache/maven-gh-actions-shared/.github/workflows/stale.yml at v4'
=====================================
LICENSE
=====================================
@@ -0,0 +1,202 @@
+
+ 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.
=====================================
README.md
=====================================
@@ -17,10 +17,9 @@
Contributing to [Apache Maven EJB Plugin](https://maven.apache.org/plugins/maven-ejb-plugin/)
======================
-[][jira]
[][license]
[](https://search.maven.org/artifact/org.apache.maven.plugins/maven-ejb-plugin)
-[](https://github.com/jvm-repo-rebuild/reproducible-central#org.apache.maven.plugins:maven-ejb-plugin)
+[](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/apache/maven/plugins/maven-ejb-plugin/README.md)
[][build]
[][test-results]
@@ -34,7 +33,6 @@ things.
Getting Started
---------------
-+ Make sure you have a [JIRA account](https://issues.apache.org/jira/).
+ Make sure you have a [GitHub account](https://github.com/signup/free).
+ If you're planning to implement a new feature, it makes sense to discuss your changes
on the [dev list][ml-list] first.
@@ -60,37 +58,23 @@ There are some guidelines which will make applying PRs easier for us:
+ Create minimal diffs - disable on save actions like reformat source code or organize imports.
If you feel the source code should be reformatted, create a separate PR for this change.
+ Check for unnecessary whitespace with `git diff --check` before committing.
-+ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue.
-```
-[MEJB-XXX] - Subject of the JIRA Ticket
- Optional supplemental description.
-```
+ Make sure you have added the necessary tests (JUnit/IT) for your changes.
+ Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken.
+ Submit a pull request to the repository in the Apache organization.
-+ Update your JIRA ticket and include a link to the pull request in the ticket.
If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla].
-Making Trivial Changes
-----------------------
-
-For changes of a trivial nature to comments and documentation, it is not always
-necessary to create a new ticket in JIRA. In this case, it is appropriate to
-start the first line of a commit with '(doc)' instead of a ticket number.
-
Additional Resources
--------------------
+ [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch)
-+ [Apache Maven EJB Plugin JIRA project page][jira]
+ [Contributor License Agreement][cla]
+ [General GitHub documentation](https://help.github.com/)
+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
-+ [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject)
-+ #Maven IRC channel on freenode.org
++ [Apache Maven X Account](https://x.com/ASFMavenProject)
++ [Apache Maven Bluesky Account](https://bsky.app/profile/maven.apache.org)
++ [Apache Maven Mastodon Account](https://mastodon.social/deck/@ASFMavenProject@fosstodon.org)
-[jira]: https://issues.apache.org/jira/projects/MEJB/
[license]: https://www.apache.org/licenses/LICENSE-2.0
[ml-list]: https://maven.apache.org/mailing-lists.html
[code-style]: https://maven.apache.org/developers/conventions/code.html
=====================================
pom.xml
=====================================
@@ -1,5 +1,4 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
+<?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
@@ -18,41 +17,40 @@ 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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugins</artifactId>
- <version>35</version>
+ <version>45</version>
<relativePath />
</parent>
<artifactId>maven-ejb-plugin</artifactId>
- <version>3.2.1</version>
+ <version>3.3.0</version>
<packaging>maven-plugin</packaging>
<name>Apache Maven EJB Plugin</name>
<description>Generates a Java Enterprise JavaBean (EJB) file as well as the associated client JAR.</description>
<prerequisites>
- <maven>${mavenVersion}</maven>
+ <maven>3.6.3</maven>
</prerequisites>
<scm>
<connection>scm:git:https://gitbox.apache.org/repos/asf/maven-ejb-plugin.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-ejb-plugin.git</developerConnection>
+ <tag>maven-ejb-plugin-3.3.0</tag>
<url>https://github.com/apache/maven-ejb-plugin/tree/${project.scm.tag}</url>
- <tag>maven-ejb-plugin-3.2.1</tag>
</scm>
<issueManagement>
- <system>JIRA</system>
- <url>https://issues.apache.org/jira/browse/MEJB</url>
+ <system>GitHub</system>
+ <url>https://github.com/apache/maven-ejb-plugin/issues/</url>
</issueManagement>
<ciManagement>
<system>Jenkins</system>
- <url>https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven-ejb-plugin/</url>
+ <url>https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-ejb-plugin/</url>
</ciManagement>
<distributionManagement>
<site>
@@ -62,10 +60,9 @@ under the License.
</distributionManagement>
<properties>
- <mavenVersion>3.2.5</mavenVersion>
- <javaVersion>8</javaVersion>
- <mavenPluginToolsVersion>3.6.4</mavenPluginToolsVersion>
- <project.build.outputTimestamp>2022-04-18T18:55:08Z</project.build.outputTimestamp>
+ <mavenVersion>3.9.6</mavenVersion>
+ <project.build.outputTimestamp>2025-11-16T13:25:35Z</project.build.outputTimestamp>
+ <version.palantirJavaFormat>2.81.0</version.palantirJavaFormat>
</properties>
<dependencies>
@@ -102,37 +99,41 @@ under the License.
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
- <version>3.5.2</version>
+ <version>3.6.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
+ <version>${version.maven-plugin-tools}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
- <version>3.2.0</version>
+ <version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
- <version>3.3.4</version>
+ <version>3.4.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
- <version>3.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-xml</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
- <version>4.2.7</version>
+ <version>4.10.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.6</version>
+ <version>2.21.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -149,18 +150,32 @@ under the License.
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
- <version>3.3.0</version>
+ <version>3.4.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
- <resources>
- <resource>
- <directory>src/main/filtered-resources</directory>
- <filtering>true</filtering>
- </resource>
- </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>3.9.0</version>
+ <executions>
+ <execution>
+ <id>analyze</id>
+ <goals>
+ <goal>analyze-only</goal>
+ </goals>
+ <configuration>
+ <excludedClasses>
+ <exclude>.*org.sample.ejb.*</exclude>
+ </excludedClasses>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
</build>
<profiles>
@@ -172,6 +187,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
+ <version>3.9.1</version>
<configuration>
<debug>true</debug>
<projectsDirectory>src/it</projectsDirectory>
=====================================
src/it/mejb-34-filtered/verify.bsh → src/it/mejb-34-filtered/verify.groovy
=====================================
=====================================
src/it/mejb-34-not-filtered/verify.bsh → src/it/mejb-34-not-filtered/verify.groovy
=====================================
=====================================
src/it/mejb-93/verify.groovy
=====================================
@@ -19,6 +19,7 @@
import java.io.*
import java.util.*
+import groovy.xml.XmlSlurper
/**
* This will filter out the version of the
@@ -52,17 +53,17 @@ if ( !jarFile.isFile() )
def buildLog = new File( basedir, "build.log" ).getText('UTF-8')
-if (!buildLog.contains ('[INFO] --- maven-ejb-plugin:' + projectVersion + ':ejb (default-ejb) @ maven-it-mejb93 ---')) {
+if (!buildLog.contains ('' + projectVersion + ':ejb (default-ejb) @ maven-it-mejb93 ---')) {
println ( "default executions did not happen.")
return false
}
-if (!buildLog.contains ('[INFO] --- maven-ejb-plugin:' + projectVersion + ':ejb (second-execution) @ maven-it-mejb93 ---')) {
+if (!buildLog.contains ('' + projectVersion + ':ejb (second-execution) @ maven-it-mejb93 ---')) {
println ( "second executions did not happen.")
return false
}
-if (!buildLog.contains ('[ERROR] Failed to execute goal org.apache.maven.plugins:maven-ejb-plugin:' + projectVersion
- + ':ejb (second-execution) on project maven-it-mejb93: '
- + 'You have to use a classifier to attach supplemental artifacts to the '
+if (!buildLog.contains ('[ERROR] Failed to execute goal org.apache.maven.plugins:maven-ejb-plugin:' + projectVersion
+ + ':ejb (second-execution) on project maven-it-mejb93: '
+ + 'You have to use a classifier to attach supplemental artifacts to the '
+ 'project instead of replacing them. -> [Help 1]')) {
println ( "exception message does not exists or the expected content does not exist.")
return false
=====================================
src/main/filtered-resources/META-INF/plexus/components.xml deleted
=====================================
@@ -1,103 +0,0 @@
-<?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.
--->
-
-<component-set>
- <components>
- <!--
- | EJB
- | -->
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>ejb</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <type>ejb</type>
- <extension>jar</extension>
- <language>java</language>
- <addedToClasspath>true</addedToClasspath>
- </configuration>
- </component>
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>ejb-client</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <type>ejb-client</type>
- <extension>jar</extension>
- <packaging>ejb</packaging>
- <classifier>client</classifier>
- <language>java</language>
- <addedToClasspath>true</addedToClasspath>
- </configuration>
- </component>
-
- <!--
- | Defining the phases with their appropriate plugins
- ! and versions which will be executed during the 'default'
- ! life cycle.
- -->
- <!--
- | EJB
- | -->
- <component>
- <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
- <role-hint>ejb</role-hint>
- <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
- <configuration>
- <lifecycles>
- <lifecycle>
- <id>default</id>
- <!-- START SNIPPET: ejb-lifecycle -->
- <phases>
- <process-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources
- </process-resources>
- <compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile
- </compile>
- <process-test-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.0.2:testResources
- </process-test-resources>
- <test-compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.5.1:testCompile
- </test-compile>
- <test>
- org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test
- </test>
- <package>
- org.apache.maven.plugins:maven-ejb-plugin:${project.version}:ejb
- </package>
- <install>
- org.apache.maven.plugins:maven-install-plugin:2.5.2:install
- </install>
- <deploy>
- org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy
- </deploy>
- </phases>
- <!-- END SNIPPET: ejb-lifecycle -->
- </lifecycle>
- </lifecycles>
- </configuration>
- </component>
-
-
- </components>
-</component-set>
=====================================
src/main/java/org/apache/maven/plugins/ejb/EjbHelper.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.ejb;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,41 +16,38 @@ package org.apache.maven.plugins.ejb;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.ejb;
import java.io.File;
/**
* This class contains some helper methods which do not belong to {@link EjbMojo}.
- *
+ *
* <pre>
* Think about this helper class, cause i've got the impression this can be made better.
* </pre>
- *
+ *
* @author <a href="mailto:khmarbaise at apache.org">Karl Heinz Marbaise</a>
*/
-public final class EjbHelper
-{
- private EjbHelper()
- {
+public final class EjbHelper {
+ private EjbHelper() {
// prevent instantiation
}
/**
* Check if a <code>classifier</code> is valid or not.
- *
+ *
* @param classifier The classifier which should be checked.
* @return true in case of a valid <code>classifier</code> false otherwise which includes the case where
* <code>classifier</code> is {@code null}.
*/
- public static boolean isClassifierValid( String classifier )
- {
+ public static boolean isClassifierValid(String classifier) {
// @FIXME: Check classifier for trailing dash? "a-0" valid?
// What are the rules for a valid classifier? Somewhere documented? which can be used as a reference?
boolean result = false;
// The following check is only based on an educated guess ;-)
- if ( hasClassifier( classifier ) && classifier.matches( "^[a-zA-Z]+[0-9a-zA-Z\\-]*" ) )
- {
+ if (hasClassifier(classifier) && classifier.matches("^[a-zA-Z]+[0-9a-zA-Z\\-]*")) {
result = true;
}
@@ -62,15 +57,13 @@ public final class EjbHelper
/**
* Check if the given classifier exists in the meaning of not being {@code null} and contain something else than
* only white spaces.
- *
+ *
* @param classifier The classifier to be used.
* @return true in case when the given classifier is not {@code null} and contains something else than white spaces.
*/
- public static boolean hasClassifier( String classifier )
- {
+ public static boolean hasClassifier(String classifier) {
boolean result = false;
- if ( classifier != null && classifier.trim().length() > 0 )
- {
+ if (classifier != null && classifier.trim().length() > 0) {
result = true;
}
return result;
@@ -84,27 +77,22 @@ public final class EjbHelper
* @param classifier an optional classifier
* @return the file to generate
*/
- public static File getJarFile( File basedir, String finalName, String classifier )
- {
- if ( basedir == null )
- {
- throw new IllegalArgumentException( "basedir is not allowed to be null" );
+ public static File getJarFile(File basedir, String finalName, String classifier) {
+ if (basedir == null) {
+ throw new IllegalArgumentException("basedir is not allowed to be null");
}
- if ( finalName == null )
- {
- throw new IllegalArgumentException( "finalName is not allowed to be null" );
+ if (finalName == null) {
+ throw new IllegalArgumentException("finalName is not allowed to be null");
}
- StringBuilder fileName = new StringBuilder( finalName );
+ StringBuilder fileName = new StringBuilder(finalName);
- if ( hasClassifier( classifier ) )
- {
- fileName.append( "-" ).append( classifier );
+ if (hasClassifier(classifier)) {
+ fileName.append("-").append(classifier);
}
- fileName.append( ".jar" );
+ fileName.append(".jar");
- return new File( basedir, fileName.toString() );
+ return new File(basedir, fileName.toString());
}
-
}
=====================================
src/main/java/org/apache/maven/plugins/ejb/EjbMojo.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.ejb;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,9 @@ package org.apache.maven.plugins.ejb;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.ejb;
+
+import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
@@ -32,18 +33,16 @@ import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
+import org.apache.maven.shared.filtering.FilterWrapper;
import org.apache.maven.shared.filtering.MavenFileFilter;
import org.apache.maven.shared.filtering.MavenFilteringException;
import org.apache.maven.shared.filtering.MavenResourcesExecution;
-import org.apache.maven.shared.utils.io.FileUtils.FilterWrapper;
-import org.codehaus.plexus.archiver.Archiver;
import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.jar.JarArchiver;
import org.codehaus.plexus.archiver.jar.ManifestException;
@@ -55,25 +54,22 @@ import org.codehaus.plexus.util.FileUtils;
* @author <a href="evenisse at apache.org">Emmanuel Venisse</a>
* @version $Id$
*/
- at Mojo( name = "ejb", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true,
- defaultPhase = LifecyclePhase.PACKAGE )
-public class EjbMojo
- extends AbstractMojo
-{
- private static final List<String> DEFAULT_INCLUDES_LIST =
- Collections.unmodifiableList( Arrays.asList( "**/**" ) );
-
- //@formatter:off
- private static final List<String> DEFAULT_CLIENT_EXCLUDES_LIST =
- Collections.unmodifiableList(
- Arrays.asList(
- "**/*Bean.class",
- "**/*CMP.class",
- "**/*Session.class",
- "**/package.html"
- )
- );
- //@formatter:on
+ at Mojo(
+ name = "ejb",
+ requiresDependencyResolution = ResolutionScope.RUNTIME,
+ threadSafe = true,
+ defaultPhase = LifecyclePhase.PACKAGE)
+public class EjbMojo extends AbstractMojo {
+ private static final List<String> DEFAULT_INCLUDES_LIST = Collections.unmodifiableList(Arrays.asList("**/**"));
+
+ private static final String EJB_TYPE = "ejb";
+
+ private static final String EJB_CLIENT_TYPE = "ejb-client";
+
+ // @formatter:off
+ private static final List<String> DEFAULT_CLIENT_EXCLUDES_LIST = Collections.unmodifiableList(
+ Arrays.asList("**/*Bean.class", "**/*CMP.class", "**/*Session.class", "**/package.html"));
+ // @formatter:on
/**
* Default value for {@link #clientClassifier}
@@ -88,19 +84,19 @@ public class EjbMojo
/**
* The directory location for the generated EJB.
*/
- @Parameter( defaultValue = "${project.build.directory}", required = true, readonly = true )
+ @Parameter(defaultValue = "${project.build.directory}", required = true, readonly = true)
private File outputDirectory;
/**
* Directory that contains the resources which are packaged into the created archive {@code target/classes}.
*/
- @Parameter( defaultValue = "${project.build.outputDirectory}", required = true )
+ @Parameter(defaultValue = "${project.build.outputDirectory}", required = true)
private File sourceDirectory;
/**
* The name of the EJB file to generate.
*/
- @Parameter( defaultValue = "${project.build.finalName}", readonly = true )
+ @Parameter(defaultValue = "${project.build.finalName}", readonly = true)
private String jarName;
/**
@@ -111,35 +107,35 @@ public class EjbMojo
/**
* Classifier which is used for the client artifact.
- *
+ *
* @since 3.0.0
*/
- @Parameter( defaultValue = DEFAULT_CLIENT_CLASSIFIER )
+ @Parameter(defaultValue = DEFAULT_CLIENT_CLASSIFIER)
private String clientClassifier;
/**
* You can define the location of <code>ejb-jar.xml</code> file.
*/
- @Parameter( defaultValue = DEFAULT_EJBJAR )
+ @Parameter(defaultValue = DEFAULT_EJBJAR)
private String ejbJar;
/**
* Whether the EJB client jar should be generated or not.
*/
- @Parameter( defaultValue = "false" )
+ @Parameter(defaultValue = "false")
private boolean generateClient;
/**
* The files and directories to exclude from the client jar. Usage:
* <p/>
- *
+ *
* <pre>
* <clientExcludes>
* <clientExclude>**/*Ejb.class</clientExclude>
* <clientExclude>**/*Bean.class</clientExclude>
* </clientExcludes>
* </pre>
- *
+ *
* <br/>
* Attribute is used only if client jar is generated. <br/>
* Default exclusions: **/*Bean.class, **/*CMP.class, **/*Session.class, **/package.html
@@ -150,13 +146,13 @@ public class EjbMojo
/**
* The files and directories to include in the client jar. Usage:
* <p/>
- *
+ *
* <pre>
* <clientIncludes>
* <clientInclude>**/*</clientInclude>
* </clientIncludes>
* </pre>
- *
+ *
* <br/>
* Attribute is used only if client jar is generated. <br/>
* Default value: **/**
@@ -167,14 +163,14 @@ public class EjbMojo
/**
* The files and directories to exclude from the main EJB jar. Usage:
* <p/>
- *
+ *
* <pre>
* <excludes>
* <exclude>**/*Ejb.class</exclude>
* <exclude>**/*Bean.class</exclude>
* </excludes>
* </pre>
- *
+ *
* <br/>
* Default exclusions: META-INF/ejb-jar.xml, **/package.html
*/
@@ -184,42 +180,24 @@ public class EjbMojo
/**
* The Maven project.
*/
- @Parameter( defaultValue = "${project}", readonly = true, required = true )
+ @Parameter(defaultValue = "${project}", readonly = true, required = true)
private MavenProject project;
- /**
- * The Jar archiver.
- */
- @Component( role = Archiver.class, hint = "jar" )
- private JarArchiver jarArchiver;
-
/**
* What EJB version should the EJB Plugin generate? Valid values are "2.x", "3.x" or "4.x" (where x is a digit).
* When ejbVersion is "2.x", the <code>ejb-jar.xml</code> file is mandatory.
* <p/>
* Usage:
- *
+ *
* <pre>
* <ejbVersion>3.0</ejbVersion>
* </pre>
- *
+ *
* @since 2.1
*/
- @Parameter( defaultValue = "3.1" )
+ @Parameter(defaultValue = "3.1")
private String ejbVersion;
- /**
- * The client Jar archiver.
- */
- @Component( role = Archiver.class, hint = "jar" )
- private JarArchiver clientJarArchiver;
-
- /**
- * The Maven project's helper.
- */
- @Component
- private MavenProjectHelper projectHelper;
-
/**
* The archive configuration to use. See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven
* Archiver Reference</a>.
@@ -232,7 +210,7 @@ public class EjbMojo
*
* @since 2.3
*/
- @Parameter( defaultValue = "false" )
+ @Parameter(defaultValue = "false")
private boolean escapeBackslashesInFilePath;
/**
@@ -248,7 +226,7 @@ public class EjbMojo
*
* @since 2.3
*/
- @Parameter( defaultValue = "false" )
+ @Parameter(defaultValue = "false")
private boolean filterDeploymentDescriptor;
/**
@@ -262,13 +240,7 @@ public class EjbMojo
/**
* @since 2.3
*/
- @Component( role = MavenFileFilter.class, hint = "default" )
- private MavenFileFilter mavenFileFilter;
-
- /**
- * @since 2.3
- */
- @Parameter( defaultValue = "${session}", readonly = true, required = true )
+ @Parameter(defaultValue = "${session}", readonly = true, required = true)
private MavenSession session;
/**
@@ -278,255 +250,231 @@ public class EjbMojo
*
* @since 3.1.0
*/
- @Parameter( defaultValue = "${project.build.outputTimestamp}" )
+ @Parameter(defaultValue = "${project.build.outputTimestamp}")
private String outputTimestamp;
- private static final String EJB_TYPE = "ejb";
+ /**
+ * The Jar archiver.
+ */
+ private final JarArchiver jarArchiver = new JarArchiver();
- private static final String EJB_CLIENT_TYPE = "ejb-client";
+ /**
+ * The client Jar archiver.
+ */
+ private JarArchiver clientJarArchiver = new JarArchiver();
+
+ /**
+ * The Maven project's helper.
+ */
+ private final MavenProjectHelper projectHelper;
+
+ /**
+ * @since 2.3
+ */
+ private final MavenFileFilter mavenFileFilter;
+
+ @Inject
+ public EjbMojo(MavenProjectHelper projectHelper, MavenFileFilter mavenFileFilter) {
+ this.projectHelper = projectHelper;
+ this.mavenFileFilter = mavenFileFilter;
+ }
/**
* Generates an EJB jar and optionally an ejb-client jar.
*/
- public void execute()
- throws MojoExecutionException
- {
-
- if ( !sourceDirectory.exists() )
- {
- getLog().warn( "The created EJB jar will be empty cause the " + sourceDirectory.getPath()
- + " did not exist." );
+ public void execute() throws MojoExecutionException {
+
+ if (!sourceDirectory.exists()) {
+ getLog().warn("The created EJB jar will be empty cause the " + sourceDirectory.getPath()
+ + " did not exist.");
sourceDirectory.mkdirs();
}
File jarFile = generateEjb();
- if ( hasClassifier() )
- {
- if ( !isClassifierValid() )
- {
+ if (hasClassifier()) {
+ if (!isClassifierValid()) {
String message = "The given classifier '" + getClassifier() + "' is not valid.";
- getLog().error( message );
- throw new MojoExecutionException( message );
+ getLog().error(message);
+ throw new MojoExecutionException(message);
}
// TODO: We should check the attached artifacts to be sure we don't attach
// the same file twice...
- projectHelper.attachArtifact( project, EJB_TYPE, getClassifier(), jarFile );
- }
- else
- {
- if ( projectHasAlreadySetAnArtifact() )
- {
- throw new MojoExecutionException( "You have to use a classifier "
- + "to attach supplemental artifacts to the project instead of replacing them." );
+ projectHelper.attachArtifact(project, EJB_TYPE, getClassifier(), jarFile);
+ } else {
+ if (projectHasAlreadySetAnArtifact()) {
+ throw new MojoExecutionException("You have to use a classifier "
+ + "to attach supplemental artifacts to the project instead of replacing them.");
}
- project.getArtifact().setFile( jarFile );
+ project.getArtifact().setFile(jarFile);
}
- if ( generateClient )
- {
+ if (generateClient) {
File clientJarFile = generateEjbClient();
- if ( hasClientClassifier() )
- {
- if ( !isClientClassifierValid() )
- {
+ if (hasClientClassifier()) {
+ if (!isClientClassifierValid()) {
String message = "The given client classifier '" + getClientClassifier() + "' is not valid.";
- getLog().error( message );
- throw new MojoExecutionException( message );
+ getLog().error(message);
+ throw new MojoExecutionException(message);
}
- projectHelper.attachArtifact( project, EJB_CLIENT_TYPE, getClientClassifier(), clientJarFile );
- }
- else
- {
+ projectHelper.attachArtifact(project, EJB_CLIENT_TYPE, getClientClassifier(), clientJarFile);
+ } else {
// FIXME: This does not make sense, cause a classifier for the client should always exist otherwise
// Failure!
- projectHelper.attachArtifact( project, "ejb-client", getClientClassifier(), clientJarFile );
+ projectHelper.attachArtifact(project, "ejb-client", getClientClassifier(), clientJarFile);
}
-
}
}
- private boolean projectHasAlreadySetAnArtifact()
- {
- if ( getProject().getArtifact().getFile() != null )
- {
+ private boolean projectHasAlreadySetAnArtifact() {
+ if (getProject().getArtifact().getFile() != null) {
return getProject().getArtifact().getFile().isFile();
- }
- else
- {
+ } else {
return false;
}
}
- private File generateEjb()
- throws MojoExecutionException
- {
- File jarFile = EjbHelper.getJarFile( outputDirectory, jarName, getClassifier() );
+ private File generateEjb() throws MojoExecutionException {
+ File jarFile = EjbHelper.getJarFile(outputDirectory, jarName, getClassifier());
- getLog().info( "Building EJB " + jarName + " with EJB version " + ejbVersion );
+ getLog().info("Building EJB " + jarName + " with EJB version " + ejbVersion);
MavenArchiver archiver = new MavenArchiver();
- archiver.setArchiver( jarArchiver );
+ archiver.setArchiver(jarArchiver);
- archiver.setCreatedBy( "Maven EJB Plugin", "org.apache.maven.plugins", "maven-ejb-plugin" );
+ archiver.setCreatedBy("Maven EJB Plugin", "org.apache.maven.plugins", "maven-ejb-plugin");
- archiver.setOutputFile( jarFile );
+ archiver.setOutputFile(jarFile);
// configure for Reproducible Builds based on outputTimestamp value
- archiver.configureReproducible( outputTimestamp );
+ archiver.configureReproducibleBuild(outputTimestamp);
- File deploymentDescriptor = new File( sourceDirectory, ejbJar );
+ File deploymentDescriptor = new File(sourceDirectory, ejbJar);
- checkEJBVersionCompliance( deploymentDescriptor );
+ checkEJBVersionCompliance(deploymentDescriptor);
- try
- {
- List<String> defaultExcludes = Arrays.asList( ejbJar, "**/package.html" );
- List<String> defaultIncludes = DEFAULT_INCLUDES_LIST;
+ try {
+ List<String> defaultExcludes = Arrays.asList(ejbJar, "**/package.html");
IncludesExcludes ie =
- new IncludesExcludes( Collections.<String>emptyList(), excludes, defaultIncludes, defaultExcludes );
+ new IncludesExcludes(Collections.emptyList(), excludes, DEFAULT_INCLUDES_LIST, defaultExcludes);
- archiver.getArchiver().addDirectory( sourceDirectory, ie.resultingIncludes(), ie.resultingExcludes() );
+ archiver.getArchiver().addDirectory(sourceDirectory, ie.resultingIncludes(), ie.resultingExcludes());
// FIXME: We should be able to filter more than just the deployment descriptor?
- if ( deploymentDescriptor.exists() )
- {
+ if (deploymentDescriptor.exists()) {
// EJB-34 Filter ejb-jar.xml
- if ( filterDeploymentDescriptor )
- {
- filterDeploymentDescriptor( deploymentDescriptor );
+ if (filterDeploymentDescriptor) {
+ filterDeploymentDescriptor(deploymentDescriptor);
}
- archiver.getArchiver().addFile( deploymentDescriptor, ejbJar );
+ archiver.getArchiver().addFile(deploymentDescriptor, ejbJar);
}
// create archive
- archiver.createArchive( session, project, archive );
- }
- catch ( ArchiverException | ManifestException | IOException | DependencyResolutionRequiredException e )
- {
- throw new MojoExecutionException( "There was a problem creating the EJB archive: " + e.getMessage(), e );
- }
- catch ( MavenFilteringException e )
- {
- throw new MojoExecutionException( "There was a problem filtering the deployment descriptor: "
- + e.getMessage(), e );
+ archiver.createArchive(session, project, archive);
+ } catch (ArchiverException | ManifestException | IOException | DependencyResolutionRequiredException e) {
+ throw new MojoExecutionException("There was a problem creating the EJB archive: " + e.getMessage(), e);
+ } catch (MavenFilteringException e) {
+ throw new MojoExecutionException(
+ "There was a problem filtering the deployment descriptor: " + e.getMessage(), e);
}
return jarFile;
-
}
- private File generateEjbClient()
- throws MojoExecutionException
- {
- File clientJarFile = EjbHelper.getJarFile( outputDirectory, jarName, getClientClassifier() );
+ private File generateEjbClient() throws MojoExecutionException {
+ File clientJarFile = EjbHelper.getJarFile(outputDirectory, jarName, getClientClassifier());
- getLog().info( "Building EJB client " + clientJarFile.getPath() );
+ getLog().info("Building EJB client " + clientJarFile.getPath());
MavenArchiver clientArchiver = new MavenArchiver();
- clientArchiver.setArchiver( clientJarArchiver );
+ clientArchiver.setArchiver(clientJarArchiver);
- clientArchiver.setCreatedBy( "Maven EJB Plugin", "org.apache.maven.plugins", "maven-ejb-plugin" );
+ clientArchiver.setCreatedBy("Maven EJB Plugin", "org.apache.maven.plugins", "maven-ejb-plugin");
- clientArchiver.setOutputFile( clientJarFile );
+ clientArchiver.setOutputFile(clientJarFile);
// configure for Reproducible Builds based on outputTimestamp value
- clientArchiver.configureReproducible( outputTimestamp );
+ clientArchiver.configureReproducibleBuild(outputTimestamp);
- try
- {
- List<String> defaultExcludes = DEFAULT_CLIENT_EXCLUDES_LIST;
- List<String> defaultIncludes = DEFAULT_INCLUDES_LIST;
+ try {
- IncludesExcludes ie =
- new IncludesExcludes( clientIncludes, clientExcludes, defaultIncludes, defaultExcludes );
+ IncludesExcludes ie = new IncludesExcludes(
+ clientIncludes, clientExcludes, DEFAULT_INCLUDES_LIST, DEFAULT_CLIENT_EXCLUDES_LIST);
- clientArchiver.getArchiver().addDirectory( sourceDirectory, ie.resultingIncludes(),
- ie.resultingExcludes() );
+ clientArchiver.getArchiver().addDirectory(sourceDirectory, ie.resultingIncludes(), ie.resultingExcludes());
- clientArchiver.createArchive( session, project, archive );
+ clientArchiver.createArchive(session, project, archive);
- }
- catch ( ArchiverException | ManifestException | IOException | DependencyResolutionRequiredException e )
- {
- throw new MojoExecutionException( "There was a problem creating the EJB client archive: " + e.getMessage(),
- e );
+ } catch (ArchiverException | ManifestException | IOException | DependencyResolutionRequiredException e) {
+ throw new MojoExecutionException(
+ "There was a problem creating the EJB client archive: " + e.getMessage(), e);
}
return clientJarFile;
}
- static void validateEjbVersion( String ejbVersion )
- throws MojoExecutionException
- {
- if ( !ejbVersion.matches( "\\A[2-4]\\.[0-9]\\z" ) )
- {
- throw new MojoExecutionException( "ejbVersion is not valid: " + ejbVersion
- + ". Must be 2.x, 3.x or 4.x (where x is a digit)" );
+ static void validateEjbVersion(String ejbVersion) throws MojoExecutionException {
+ if (!ejbVersion.matches("\\A[2-4]\\.[0-9]\\z")) {
+ throw new MojoExecutionException(
+ "ejbVersion is not valid: " + ejbVersion + ". Must be 2.x, 3.x or 4.x (where x is a digit)");
}
}
- private void checkEJBVersionCompliance( File deploymentDescriptor )
- throws MojoExecutionException
- {
- validateEjbVersion( ejbVersion );
+ private void checkEJBVersionCompliance(File deploymentDescriptor) throws MojoExecutionException {
+ validateEjbVersion(ejbVersion);
- if ( ejbVersion.matches( "\\A2\\.[0-9]\\z" ) && !deploymentDescriptor.exists() )
- {
- throw new MojoExecutionException( "Error assembling EJB: " + ejbJar + " is required for ejbVersion 2.x" );
+ if (ejbVersion.matches("\\A2\\.[0-9]\\z") && !deploymentDescriptor.exists()) {
+ throw new MojoExecutionException("Error assembling EJB: " + ejbJar + " is required for ejbVersion 2.x");
}
}
- private void filterDeploymentDescriptor( File deploymentDescriptor )
- throws MavenFilteringException, IOException
- {
- getLog().debug( "Filtering deployment descriptor." );
+ private void filterDeploymentDescriptor(File deploymentDescriptor) throws MavenFilteringException, IOException {
+ getLog().debug("Filtering deployment descriptor.");
MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution();
- mavenResourcesExecution.setEscapeString( escapeString );
- List<FilterWrapper> filterWrappers =
- mavenFileFilter.getDefaultFilterWrappers( project, filters, escapeBackslashesInFilePath, this.session,
- mavenResourcesExecution );
+ mavenResourcesExecution.setEscapeString(escapeString);
+ List<FilterWrapper> filterWrappers = mavenFileFilter.getDefaultFilterWrappers(
+ project, filters, escapeBackslashesInFilePath, this.session, mavenResourcesExecution);
// Create a temporary file that we can copy-and-filter
- File unfilteredDeploymentDescriptor = new File( sourceDirectory, ejbJar + ".unfiltered" );
- FileUtils.copyFile( deploymentDescriptor, unfilteredDeploymentDescriptor );
- mavenFileFilter.copyFile( unfilteredDeploymentDescriptor, deploymentDescriptor, true, filterWrappers,
- getEncoding( unfilteredDeploymentDescriptor ) );
+ File unfilteredDeploymentDescriptor = new File(sourceDirectory, ejbJar + ".unfiltered");
+ FileUtils.copyFile(deploymentDescriptor, unfilteredDeploymentDescriptor);
+ mavenFileFilter.copyFile(
+ unfilteredDeploymentDescriptor,
+ deploymentDescriptor,
+ true,
+ filterWrappers,
+ getEncoding(unfilteredDeploymentDescriptor));
// Remove the temporary file
- FileUtils.forceDelete( unfilteredDeploymentDescriptor );
+ FileUtils.forceDelete(unfilteredDeploymentDescriptor);
}
/**
* @return true in case where the classifier is not {@code null} and contains something else than white spaces.
*/
- private boolean hasClassifier()
- {
- return EjbHelper.hasClassifier( getClassifier() );
+ private boolean hasClassifier() {
+ return EjbHelper.hasClassifier(getClassifier());
}
/**
* @return true in case where the clientClassifier is not {@code null} and contains something else than white
* spaces.
*/
- private boolean hasClientClassifier()
- {
- return EjbHelper.hasClassifier( getClientClassifier() );
+ private boolean hasClientClassifier() {
+ return EjbHelper.hasClassifier(getClientClassifier());
}
- private boolean isClassifierValid()
- {
- return EjbHelper.isClassifierValid( getClassifier() );
+ private boolean isClassifierValid() {
+ return EjbHelper.isClassifierValid(getClassifier());
}
- private boolean isClientClassifierValid()
- {
- return EjbHelper.isClassifierValid( getClientClassifier() );
+ private boolean isClientClassifierValid() {
+ return EjbHelper.isClassifierValid(getClientClassifier());
}
/**
@@ -536,29 +484,22 @@ public class EjbMojo
* @return The encoding of the XML file, or UTF-8 if it's not specified in the file
* @throws IOException if an error occurred while reading the file
*/
- private String getEncoding( File xmlFile )
- throws IOException
- {
- try ( XmlStreamReader xmlReader = new XmlStreamReader( xmlFile ) )
- {
- final String encoding = xmlReader.getEncoding();
- return encoding;
+ private String getEncoding(File xmlFile) throws IOException {
+ try (XmlStreamReader xmlReader =
+ XmlStreamReader.builder().setFile(xmlFile).get()) {
+ return xmlReader.getEncoding();
}
}
- public String getClassifier()
- {
+ public String getClassifier() {
return classifier;
}
- public String getClientClassifier()
- {
+ public String getClientClassifier() {
return clientClassifier;
}
- public MavenProject getProject()
- {
+ public MavenProject getProject() {
return project;
}
-
}
=====================================
src/main/java/org/apache/maven/plugins/ejb/IncludesExcludes.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.ejb;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.ejb;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.ejb;
import java.util.Collections;
import java.util.List;
@@ -25,8 +24,7 @@ import java.util.List;
/**
* @author <a href="mailto:khmarbaise at apache.org">Karl Heinz Marbaise</a>
*/
-public class IncludesExcludes
-{
+public class IncludesExcludes {
private List<String> includes;
private List<String> defaultIncludes;
@@ -35,47 +33,35 @@ public class IncludesExcludes
private List<String> defaultExcludes;
- public IncludesExcludes( List<String> includes, List<String> excludes, List<String> defaultIncludes,
- List<String> defaultExcludes )
- {
- this.includes = makeNonNullList( includes );
- this.excludes = makeNonNullList( excludes );
- this.defaultIncludes = makeNonNullList( defaultIncludes );
- this.defaultExcludes = makeNonNullList( defaultExcludes );
+ public IncludesExcludes(
+ List<String> includes, List<String> excludes, List<String> defaultIncludes, List<String> defaultExcludes) {
+ this.includes = makeNonNullList(includes);
+ this.excludes = makeNonNullList(excludes);
+ this.defaultIncludes = makeNonNullList(defaultIncludes);
+ this.defaultExcludes = makeNonNullList(defaultExcludes);
}
- public String[] resultingIncludes()
- {
- return resultingXcludes( includes, defaultIncludes );
+ public String[] resultingIncludes() {
+ return resultingXcludes(includes, defaultIncludes);
}
- public String[] resultingExcludes()
- {
- return resultingXcludes( excludes, defaultExcludes );
+ public String[] resultingExcludes() {
+ return resultingXcludes(excludes, defaultExcludes);
}
- private static String[] resultingXcludes( List<String> currentXcludes, List<String> defaultXcludes )
- {
- if ( currentXcludes.isEmpty() )
- {
- return defaultXcludes.toArray( new String[0] );
- }
- else
- {
- return currentXcludes.toArray( new String[0] );
+ private static String[] resultingXcludes(List<String> currentXcludes, List<String> defaultXcludes) {
+ if (currentXcludes.isEmpty()) {
+ return defaultXcludes.toArray(new String[0]);
+ } else {
+ return currentXcludes.toArray(new String[0]);
}
}
- private List<String> makeNonNullList( List<String> in )
- {
- if ( in == null )
- {
+ private List<String> makeNonNullList(List<String> in) {
+ if (in == null) {
return Collections.<String>emptyList();
- }
- else
- {
+ } else {
return in;
}
}
-
}
=====================================
src/site/site.xml
=====================================
@@ -23,7 +23,7 @@ under the License.
<body>
<menu name="Overview">
<item name="Introduction" href="index.html"/>
- <item name="Goals" href="plugin-info.html"/>
+ <item name="Plugin Documentation" href="plugin-info.html"/>
<item name="Usage" href="usage.html"/>
<item name="FAQ" href="faq.html"/>
<!-- According to https://issues.apache.org/jira/browse/MNGSITE-152 -->
=====================================
src/test/java/org/apache/maven/plugins/ejb/EjbHelperTest.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.ejb;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,74 +16,62 @@ package org.apache.maven.plugins.ejb;
* specific language governing permissions and limitations
* under the License.
*/
-
+package org.apache.maven.plugins.ejb;
import java.io.File;
import org.junit.Assert;
import org.junit.Test;
-public class EjbHelperTest
-{
+public class EjbHelperTest {
@Test
- public void validClassifier()
- {
- Assert.assertTrue( EjbHelper.isClassifierValid( "anton" ) );
+ public void validClassifier() {
+ Assert.assertTrue(EjbHelper.isClassifierValid("anton"));
}
@Test
- public void anOtherValidClassifier()
- {
- Assert.assertTrue( EjbHelper.isClassifierValid( "jdk15" ) );
+ public void anOtherValidClassifier() {
+ Assert.assertTrue(EjbHelper.isClassifierValid("jdk15"));
}
@Test
- public void moreValidClassifier()
- {
- Assert.assertTrue( EjbHelper.isClassifierValid( "client-classifier" ) );
+ public void moreValidClassifier() {
+ Assert.assertTrue(EjbHelper.isClassifierValid("client-classifier"));
}
@Test
- public void isClassifierValidShouldReturnFalseIfClassifierIsPrefixedByDash()
- {
- Assert.assertFalse( EjbHelper.isClassifierValid( "-anton" ) );
+ public void isClassifierValidShouldReturnFalseIfClassifierIsPrefixedByDash() {
+ Assert.assertFalse(EjbHelper.isClassifierValid("-anton"));
}
@Test
- public void isClassifierValidShouldReturnFalseIfClassifierIsNull()
- {
- Assert.assertFalse( EjbHelper.isClassifierValid( null ) );
+ public void isClassifierValidShouldReturnFalseIfClassifierIsNull() {
+ Assert.assertFalse(EjbHelper.isClassifierValid(null));
}
@Test
- public void hasClassifierShouldReturnFalseForNull()
- {
- Assert.assertFalse( EjbHelper.hasClassifier( null ) );
+ public void hasClassifierShouldReturnFalseForNull() {
+ Assert.assertFalse(EjbHelper.hasClassifier(null));
}
@Test
- public void hasClassifierShouldReturnFalseForEmptyString()
- {
- Assert.assertFalse( EjbHelper.hasClassifier( "" ) );
+ public void hasClassifierShouldReturnFalseForEmptyString() {
+ Assert.assertFalse(EjbHelper.hasClassifier(""));
}
@Test
- public void hasClassifierShouldReturnTrueForNonEmptyString()
- {
- Assert.assertTrue( EjbHelper.hasClassifier( "x" ) );
+ public void hasClassifierShouldReturnTrueForNonEmptyString() {
+ Assert.assertTrue(EjbHelper.hasClassifier("x"));
}
@Test
- public void getJarFileNameShouldReturnFileNameWithoutClassifier()
- {
- Assert.assertEquals( EjbHelper.getJarFile( new File( "base" ), "test", null ), new File( "base/test.jar" ) );
+ public void getJarFileNameShouldReturnFileNameWithoutClassifier() {
+ Assert.assertEquals(EjbHelper.getJarFile(new File("base"), "test", null), new File("base/test.jar"));
}
@Test
- public void getJarFileNameShouldReturnFileNameWithClassifier()
- {
- Assert.assertEquals( EjbHelper.getJarFile( new File( "base" ), "test",
- "alpha" ), new File( "base/test-alpha.jar" ) );
+ public void getJarFileNameShouldReturnFileNameWithClassifier() {
+ Assert.assertEquals(EjbHelper.getJarFile(new File("base"), "test", "alpha"), new File("base/test-alpha.jar"));
}
}
=====================================
src/test/java/org/apache/maven/plugins/ejb/EjbMojoTest.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.ejb;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.ejb;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.ejb;
import java.io.File;
import java.io.IOException;
@@ -30,14 +29,11 @@ import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugins.ejb.stub.MavenProjectResourcesStub;
import org.apache.maven.plugins.ejb.utils.JarContentChecker;
import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.util.FileUtils;
/**
* EJB plugin Test Case
*/
-public class EjbMojoTest
- extends AbstractMojoTestCase
-{
+public class EjbMojoTest extends AbstractMojoTestCase {
static final String DEFAULT_POM_PATH = "target/test-classes/unit/ejbmojotest/plugin-config.xml";
static final String DEFAULT_JAR_NAME = "testJar";
@@ -47,9 +43,7 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testTestEnvironment()
- throws Exception
- {
+ public void testTestEnvironment() throws Exception {
// Perform lookup on the Mojo to make sure everything is ok
lookupMojo();
}
@@ -59,20 +53,18 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testDefaultWithoutClientJar()
- throws Exception
- {
- final MavenProjectResourcesStub project = createTestProject( "default-noclient" );
- final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
+ public void testDefaultWithoutClientJar() throws Exception {
+ final MavenProjectResourcesStub project = createTestProject("default-noclient");
+ final EjbMojo mojo = lookupMojoWithDefaultSettings(project);
- setupDefaultProject( project );
+ setupDefaultProject(project);
- setVariableValueToObject( mojo, "generateClient", Boolean.FALSE );
- setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.FALSE);
+ setVariableValueToObject(mojo, "ejbVersion", "2.1");
mojo.execute();
- assertJarCreation( project, true, false );
+ assertJarCreation(project, true, false);
}
/**
@@ -80,21 +72,19 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testClassifiedJarWithoutClientJar()
- throws Exception
- {
- final MavenProjectResourcesStub project = createTestProject( "classified-noclient" );
- final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
+ public void testClassifiedJarWithoutClientJar() throws Exception {
+ final MavenProjectResourcesStub project = createTestProject("classified-noclient");
+ final EjbMojo mojo = lookupMojoWithDefaultSettings(project);
- setupDefaultProject( project );
+ setupDefaultProject(project);
- setVariableValueToObject( mojo, "generateClient", Boolean.FALSE );
- setVariableValueToObject( mojo, "ejbVersion", "2.1" );
- setVariableValueToObject( mojo, "classifier", "classified" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.FALSE);
+ setVariableValueToObject(mojo, "ejbVersion", "2.1");
+ setVariableValueToObject(mojo, "classifier", "classified");
mojo.execute();
- assertJarCreation( project, true, false, "classified" );
+ assertJarCreation(project, true, false, "classified");
}
/**
@@ -102,20 +92,18 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testDefaultWithClientJar()
- throws Exception
- {
- final MavenProjectResourcesStub project = createTestProject( "default-client" );
- final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
+ public void testDefaultWithClientJar() throws Exception {
+ final MavenProjectResourcesStub project = createTestProject("default-client");
+ final EjbMojo mojo = lookupMojoWithDefaultSettings(project);
- setupDefaultProject( project );
+ setupDefaultProject(project);
- setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
- setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.TRUE);
+ setVariableValueToObject(mojo, "ejbVersion", "2.1");
mojo.execute();
- assertJarCreation( project, true, true );
+ assertJarCreation(project, true, true);
}
/**
@@ -123,22 +111,20 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testClassifiedJarWithClientJar()
- throws Exception
- {
- final MavenProjectResourcesStub project = createTestProject( "classified-client" );
- final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
+ public void testClassifiedJarWithClientJar() throws Exception {
+ final MavenProjectResourcesStub project = createTestProject("classified-client");
+ final EjbMojo mojo = lookupMojoWithDefaultSettings(project);
- setupDefaultProject( project );
+ setupDefaultProject(project);
- setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
- setVariableValueToObject( mojo, "ejbVersion", "2.1" );
- setVariableValueToObject( mojo, "classifier", "classified" );
- setVariableValueToObject( mojo, "clientClassifier", "classified-client" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.TRUE);
+ setVariableValueToObject(mojo, "ejbVersion", "2.1");
+ setVariableValueToObject(mojo, "classifier", "classified");
+ setVariableValueToObject(mojo, "clientClassifier", "classified-client");
mojo.execute();
- assertJarCreation( project, true, true, "classified" );
+ assertJarCreation(project, true, true, "classified");
}
/**
@@ -146,38 +132,41 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testDefaultInclusionsExclusions()
- throws Exception
- {
+ public void testDefaultInclusionsExclusions() throws Exception {
- final MavenProjectResourcesStub project = createTestProject( "includes-excludes-default" );
- final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
+ final MavenProjectResourcesStub project = createTestProject("includes-excludes-default");
+ final EjbMojo mojo = lookupMojoWithDefaultSettings(project);
// put this on the target output dir
- project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppBean.class", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppCMP.class", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppSession.class", MavenProjectResourcesStub.OUTPUT_FILE );
+ project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppBean.class", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppCMP.class", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppSession.class", MavenProjectResourcesStub.OUTPUT_FILE);
// put this on the root dir
- project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+ project.addFile("pom.xml", MavenProjectResourcesStub.ROOT_FILE);
// start creating the environment
project.setupBuildEnvironment();
- setVariableValueToObject( mojo, "generateClient", Boolean.FALSE );
- setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.FALSE);
+ setVariableValueToObject(mojo, "ejbVersion", "2.1");
mojo.execute();
- assertJarCreation( project, true, false );
- assertJarContent( project,
- new String[] { "META-INF/MANIFEST.MF", "META-INF/ejb-jar.xml",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
- "org/sample/ejb/AppBean.class", "org/sample/ejb/AppCMP.class",
- "org/sample/ejb/AppSession.class" },
- null );
+ assertJarCreation(project, true, false);
+ assertJarContent(
+ project,
+ new String[] {
+ "META-INF/MANIFEST.MF",
+ "META-INF/ejb-jar.xml",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
+ "org/sample/ejb/AppBean.class",
+ "org/sample/ejb/AppCMP.class",
+ "org/sample/ejb/AppSession.class"
+ },
+ null);
}
/**
@@ -185,39 +174,44 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testClientJarDefaultInclusionsExclusions()
- throws Exception
- {
+ public void testClientJarDefaultInclusionsExclusions() throws Exception {
- final MavenProjectResourcesStub project = createTestProject( "includes-excludes-client" );
- final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
+ final MavenProjectResourcesStub project = createTestProject("includes-excludes-client");
+ final EjbMojo mojo = lookupMojoWithDefaultSettings(project);
// put this on the target output dir
- project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppBean.class", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppCMP.class", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppSession.class", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppStub.class", MavenProjectResourcesStub.OUTPUT_FILE );
+ project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppBean.class", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppCMP.class", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppSession.class", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppStub.class", MavenProjectResourcesStub.OUTPUT_FILE);
// put this on the root dir
- project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+ project.addFile("pom.xml", MavenProjectResourcesStub.ROOT_FILE);
// start creating the environment
project.setupBuildEnvironment();
- setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
- setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.TRUE);
+ setVariableValueToObject(mojo, "ejbVersion", "2.1");
mojo.execute();
- assertJarCreation( project, true, true );
- assertClientJarContent( project,
- new String[] { "META-INF/MANIFEST.MF",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
- "org/sample/ejb/AppStub.class" },
- new String[] { "META-INF/ejb-jar.xml", "org/sample/ejb/AppBean.class",
- "org/sample/ejb/AppCMP.class", "org/sample/ejb/AppSession.class" } );
+ assertJarCreation(project, true, true);
+ assertClientJarContent(
+ project,
+ new String[] {
+ "META-INF/MANIFEST.MF",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
+ "org/sample/ejb/AppStub.class"
+ },
+ new String[] {
+ "META-INF/ejb-jar.xml",
+ "org/sample/ejb/AppBean.class",
+ "org/sample/ejb/AppCMP.class",
+ "org/sample/ejb/AppSession.class"
+ });
}
/**
@@ -225,38 +219,39 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testClientJarInclusions()
- throws Exception
- {
- final List<String> inclusions = new LinkedList<String>();
- inclusions.add( "**/*Include.class" );
+ public void testClientJarInclusions() throws Exception {
+ final List<String> inclusions = new LinkedList<>();
+ inclusions.add("**/*Include.class");
- final MavenProjectResourcesStub project = createTestProject( "client-includes" );
- final EjbMojo mojo = lookupMojoWithSettings( project, inclusions, new LinkedList<String>(), null );
+ final MavenProjectResourcesStub project = createTestProject("client-includes");
+ final EjbMojo mojo = lookupMojoWithSettings(project, inclusions, new LinkedList<>(), null);
// put this on the target output dir
- project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
+ project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE);
// put this on the root dir
- project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+ project.addFile("pom.xml", MavenProjectResourcesStub.ROOT_FILE);
// start creating the environment
project.setupBuildEnvironment();
- setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
- setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.TRUE);
+ setVariableValueToObject(mojo, "ejbVersion", "2.1");
mojo.execute();
- assertJarCreation( project, true, true );
- assertClientJarContent( project,
- new String[] { "META-INF/MANIFEST.MF",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
- "org/sample/ejb/AppInclude.class" },
- new String[] { "META-INF/ejb-jar.xml", "org/sample/ejb/AppExclude.class" } );
+ assertJarCreation(project, true, true);
+ assertClientJarContent(
+ project,
+ new String[] {
+ "META-INF/MANIFEST.MF",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
+ "org/sample/ejb/AppInclude.class"
+ },
+ new String[] {"META-INF/ejb-jar.xml", "org/sample/ejb/AppExclude.class"});
}
/**
@@ -264,40 +259,40 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testClientJarExclusions()
- throws Exception
- {
+ public void testClientJarExclusions() throws Exception {
- final List<String> exclusions = new LinkedList<String>();
- exclusions.add( "**/*Exclude.class" );
+ final List<String> exclusions = new LinkedList<>();
+ exclusions.add("**/*Exclude.class");
- final MavenProjectResourcesStub project = createTestProject( "client-excludes" );
- final EjbMojo mojo = lookupMojoWithSettings( project, new LinkedList<String>(), exclusions, null );
+ final MavenProjectResourcesStub project = createTestProject("client-excludes");
+ final EjbMojo mojo = lookupMojoWithSettings(project, new LinkedList<>(), exclusions, null);
// put this on the target output dir
- project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
+ project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE);
// put this on the root dir
- project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+ project.addFile("pom.xml", MavenProjectResourcesStub.ROOT_FILE);
// start creating the environment
project.setupBuildEnvironment();
- setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
- setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.TRUE);
+ setVariableValueToObject(mojo, "ejbVersion", "2.1");
mojo.execute();
- assertJarCreation( project, true, true );
- assertClientJarContent( project,
- new String[] { "META-INF/MANIFEST.MF",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
- "org/sample/ejb/AppInclude.class" },
- new String[] { "META-INF/ejb-jar.xml", "org/sample/ejb/AppExclude.class" } );
-
+ assertJarCreation(project, true, true);
+ assertClientJarContent(
+ project,
+ new String[] {
+ "META-INF/MANIFEST.MF",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
+ "org/sample/ejb/AppInclude.class"
+ },
+ new String[] {"META-INF/ejb-jar.xml", "org/sample/ejb/AppExclude.class"});
}
/**
@@ -305,40 +300,39 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testMainJarExclusions()
- throws Exception
- {
- final List<String> exclusions = new LinkedList<String>();
- exclusions.add( "**/*Exclude.class" );
+ public void testMainJarExclusions() throws Exception {
+ final List<String> exclusions = new LinkedList<>();
+ exclusions.add("**/*Exclude.class");
- final MavenProjectResourcesStub project = createTestProject( "main-excludes" );
- final EjbMojo mojo =
- lookupMojoWithSettings( project, new LinkedList<String>(), new LinkedList<String>(), exclusions );
+ final MavenProjectResourcesStub project = createTestProject("main-excludes");
+ final EjbMojo mojo = lookupMojoWithSettings(project, new LinkedList<>(), new LinkedList<>(), exclusions);
// put this on the target output dir
- project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
+ project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE);
// put this on the root dir
- project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+ project.addFile("pom.xml", MavenProjectResourcesStub.ROOT_FILE);
// start creating the environment
project.setupBuildEnvironment();
- setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
- setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.TRUE);
+ setVariableValueToObject(mojo, "ejbVersion", "2.1");
mojo.execute();
- assertJarCreation( project, true, true );
- assertJarContent( project,
- new String[] { "META-INF/MANIFEST.MF",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
- "org/sample/ejb/AppInclude.class" },
- new String[] { "META-INF/ejb-jar.xml", "org/sample/ejb/AppExclude.class" } );
-
+ assertJarCreation(project, true, true);
+ assertJarContent(
+ project,
+ new String[] {
+ "META-INF/MANIFEST.MF",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
+ "org/sample/ejb/AppInclude.class"
+ },
+ new String[] {"META-INF/ejb-jar.xml", "org/sample/ejb/AppExclude.class"});
}
/**
@@ -346,40 +340,40 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testClientJarInclusionsWithSubPackage()
- throws Exception
- {
- final List<String> inclusions = new LinkedList<String>();
- inclusions.add( "org/sample/ejb/*.class" );
+ public void testClientJarInclusionsWithSubPackage() throws Exception {
+ final List<String> inclusions = new LinkedList<>();
+ inclusions.add("org/sample/ejb/*.class");
- final MavenProjectResourcesStub project = createTestProject( "client-includes-subpackage" );
+ final MavenProjectResourcesStub project = createTestProject("client-includes-subpackage");
- final EjbMojo mojo = lookupMojoWithSettings( project, inclusions, new LinkedList<String>(), null );
+ final EjbMojo mojo = lookupMojoWithSettings(project, inclusions, new LinkedList<>(), null);
// put this on the target output dir
- project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/App.class", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/impl/AppImpl.class", MavenProjectResourcesStub.OUTPUT_FILE );
+ project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/App.class", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/impl/AppImpl.class", MavenProjectResourcesStub.OUTPUT_FILE);
// put this on the root dir
- project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+ project.addFile("pom.xml", MavenProjectResourcesStub.ROOT_FILE);
// start creating the environment
project.setupBuildEnvironment();
- setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
- setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.TRUE);
+ setVariableValueToObject(mojo, "ejbVersion", "2.1");
mojo.execute();
- assertJarCreation( project, true, true );
- assertClientJarContent( project,
- new String[] { "META-INF/MANIFEST.MF",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
- "org/sample/ejb/App.class" },
- new String[] { "META-INF/ejb-jar.xml", "org/sample/ejb/impl/AppImpl.class",
- "org/sample/ejb/impl" } );
+ assertJarCreation(project, true, true);
+ assertClientJarContent(
+ project,
+ new String[] {
+ "META-INF/MANIFEST.MF",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
+ "org/sample/ejb/App.class"
+ },
+ new String[] {"META-INF/ejb-jar.xml", "org/sample/ejb/impl/AppImpl.class", "org/sample/ejb/impl"});
}
/**
@@ -387,43 +381,42 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testClientJarExclusionsWithEmptyPackage()
- throws Exception
- {
+ public void testClientJarExclusionsWithEmptyPackage() throws Exception {
- final LinkedList<String> exclusions = new LinkedList<String>();
- exclusions.add( "org/sample/ejb/**" );
+ final LinkedList<String> exclusions = new LinkedList<>();
+ exclusions.add("org/sample/ejb/**");
- final MavenProjectResourcesStub project = createTestProject( "client-excludes-emptypackage" );
- final EjbMojo mojo = lookupMojoWithSettings( project, new LinkedList<String>(), exclusions, null );
+ final MavenProjectResourcesStub project = createTestProject("client-excludes-emptypackage");
+ final EjbMojo mojo = lookupMojoWithSettings(project, new LinkedList<>(), exclusions, null);
// put this on the target output dir
- project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb/AppOne.class", MavenProjectResourcesStub.OUTPUT_FILE );
- project.addFile( "org/sample/ejb2/AppTwo.class", MavenProjectResourcesStub.OUTPUT_FILE );
+ project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb/AppOne.class", MavenProjectResourcesStub.OUTPUT_FILE);
+ project.addFile("org/sample/ejb2/AppTwo.class", MavenProjectResourcesStub.OUTPUT_FILE);
// put this on the root dir
- project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+ project.addFile("pom.xml", MavenProjectResourcesStub.ROOT_FILE);
// start creating the environment
project.setupBuildEnvironment();
- setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
- setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.TRUE);
+ setVariableValueToObject(mojo, "ejbVersion", "2.1");
mojo.execute();
- assertJarCreation( project, true, true );
+ assertJarCreation(project, true, true);
// We check that the created jar does not contain the org/sample/ejb package empty
- assertClientJarContent( project,
- new String[] { "META-INF/MANIFEST.MF",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
- "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
- "org/sample/ejb2/AppTwo.class" },
- new String[] { "META-INF/ejb-jar.xml", "org/sample/ejb/AppOne.class",
- "org/sample/ejb" } );
-
+ assertClientJarContent(
+ project,
+ new String[] {
+ "META-INF/MANIFEST.MF",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
+ "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties",
+ "org/sample/ejb2/AppTwo.class"
+ },
+ new String[] {"META-INF/ejb-jar.xml", "org/sample/ejb/AppOne.class", "org/sample/ejb"});
}
/**
@@ -432,28 +425,23 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testEjbComplianceVersionTwoDotOneWithoutDescriptor()
- throws Exception
- {
- final MavenProjectResourcesStub project = createTestProject( "compliance-nodescriptor-2.1" );
- final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
+ public void testEjbComplianceVersionTwoDotOneWithoutDescriptor() throws Exception {
+ final MavenProjectResourcesStub project = createTestProject("compliance-nodescriptor-2.1");
+ final EjbMojo mojo = lookupMojoWithDefaultSettings(project);
// put this on the root dir
- project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+ project.addFile("pom.xml", MavenProjectResourcesStub.ROOT_FILE);
// start creating the environment
project.setupBuildEnvironment();
- setVariableValueToObject( mojo, "generateClient", Boolean.FALSE );
- setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.FALSE);
+ setVariableValueToObject(mojo, "ejbVersion", "2.1");
- try
- {
+ try {
mojo.execute();
- fail( "Exception should be thrown: No deployment descriptor present." );
- }
- catch ( MojoExecutionException e )
- {
+ fail("Exception should be thrown: No deployment descriptor present.");
+ } catch (MojoExecutionException e) {
// OK
}
}
@@ -463,29 +451,26 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testEjbComplianceVersionThreeWithDescriptor()
- throws Exception
- {
+ public void testEjbComplianceVersionThreeWithDescriptor() throws Exception {
- final MavenProjectResourcesStub project = createTestProject( "compliance-descriptor-3" );
- final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
+ final MavenProjectResourcesStub project = createTestProject("compliance-descriptor-3");
+ final EjbMojo mojo = lookupMojoWithDefaultSettings(project);
// put this on the target dir
- project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
+ project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE);
// put this on the root dir
- project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+ project.addFile("pom.xml", MavenProjectResourcesStub.ROOT_FILE);
// start creating the environment
project.setupBuildEnvironment();
- setVariableValueToObject( mojo, "generateClient", Boolean.FALSE );
- setVariableValueToObject( mojo, "ejbVersion", "3.0" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.FALSE);
+ setVariableValueToObject(mojo, "ejbVersion", "3.0");
mojo.execute();
- assertJarCreation( project, true, false );
-
+ assertJarCreation(project, true, false);
}
/**
@@ -493,183 +478,152 @@ public class EjbMojoTest
*
* @throws Exception if any exception occurs
*/
- public void testEjbCompliance_3_0_WithoutDescriptor()
- throws Exception
- {
- final MavenProjectResourcesStub project = createTestProject( "compliance-nodescriptor-3" );
- final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
+ public void testEjbCompliance30WithoutDescriptor() throws Exception {
+ final MavenProjectResourcesStub project = createTestProject("compliance-nodescriptor-3");
+ final EjbMojo mojo = lookupMojoWithDefaultSettings(project);
// put this on the root dir
- project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+ project.addFile("pom.xml", MavenProjectResourcesStub.ROOT_FILE);
// start creating the environment
project.setupBuildEnvironment();
- setVariableValueToObject( mojo, "generateClient", Boolean.FALSE );
- setVariableValueToObject( mojo, "ejbVersion", "3.0" );
+ setVariableValueToObject(mojo, "generateClient", Boolean.FALSE);
+ setVariableValueToObject(mojo, "ejbVersion", "3.0");
mojo.execute();
- assertJarCreation( project, true, false );
+ assertJarCreation(project, true, false);
}
- public void testEjb1VersionValidation()
- {
- try
- {
- EjbMojo.validateEjbVersion( "1.1" );
- fail( "MojoException is expected" );
- }
- catch ( MojoExecutionException mex )
- {
+ public void testEjb1VersionValidation() {
+ try {
+ EjbMojo.validateEjbVersion("1.1");
+ fail("MojoException is expected");
+ } catch (MojoExecutionException mex) {
}
}
- public void testEjb2VersionValidation()
- throws MojoExecutionException
- {
- EjbMojo.validateEjbVersion( "2.1" );
+ public void testEjb2VersionValidation() throws MojoExecutionException {
+ EjbMojo.validateEjbVersion("2.1");
}
- public void testEjb3VersionValidation()
- throws MojoExecutionException
- {
- EjbMojo.validateEjbVersion( "3.2" );
+ public void testEjb3VersionValidation() throws MojoExecutionException {
+ EjbMojo.validateEjbVersion("3.2");
}
- public void testEjb4VersionValidation()
- throws MojoExecutionException
- {
- EjbMojo.validateEjbVersion( "4.0" );
+ public void testEjb4VersionValidation() throws MojoExecutionException {
+ EjbMojo.validateEjbVersion("4.0");
}
- protected EjbMojo lookupMojo()
- throws Exception
- {
- File pomFile = new File( getBasedir(), DEFAULT_POM_PATH );
- EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
+ protected EjbMojo lookupMojo() throws Exception {
+ File pomFile = new File(getBasedir(), DEFAULT_POM_PATH);
+ EjbMojo mojo = (EjbMojo) lookupMojo("ejb", pomFile);
- assertNotNull( mojo );
+ assertNotNull(mojo);
return mojo;
}
- protected MavenProjectResourcesStub createTestProject( final String testName )
- throws Exception
- {
+ protected MavenProjectResourcesStub createTestProject(final String testName) throws Exception {
// this will automatically create the isolated
// test environment
- return new MavenProjectResourcesStub( testName );
+ return new MavenProjectResourcesStub(testName);
}
- protected void setupDefaultProject( final MavenProjectResourcesStub project )
- throws Exception
- {
+ protected void setupDefaultProject(final MavenProjectResourcesStub project) throws Exception {
// put this on the target dir
- project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
+ project.addFile("META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE);
// put this on the root dir
- project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+ project.addFile("pom.xml", MavenProjectResourcesStub.ROOT_FILE);
// start creating the environment
project.setupBuildEnvironment();
-
}
- protected EjbMojo lookupMojoWithSettings( final MavenProject project, List<String> clientIncludes,
- List<String> clientExcludes, List<String> excludes )
- throws Exception
- {
+ protected EjbMojo lookupMojoWithSettings(
+ final MavenProject project, List<String> clientIncludes, List<String> clientExcludes, List<String> excludes)
+ throws Exception {
final EjbMojo mojo = lookupMojo();
- setVariableValueToObject( mojo, "project", project );
- setVariableValueToObject( mojo, "outputDirectory", new File( project.getBuild().getDirectory() ) );
- setVariableValueToObject( mojo, "sourceDirectory", new File( project.getBuild().getOutputDirectory() ) );
- setVariableValueToObject( mojo, "jarName", DEFAULT_JAR_NAME );
- setVariableValueToObject( mojo, "ejbJar", EjbMojo.DEFAULT_EJBJAR );
- setVariableValueToObject( mojo, "clientExcludes", clientExcludes );
- setVariableValueToObject( mojo, "clientIncludes", clientIncludes );
- setVariableValueToObject( mojo, "excludes", excludes );
- setVariableValueToObject( mojo, "clientClassifier", EjbMojo.DEFAULT_CLIENT_CLASSIFIER );
+ setVariableValueToObject(mojo, "project", project);
+ setVariableValueToObject(
+ mojo, "outputDirectory", new File(project.getBuild().getDirectory()));
+ setVariableValueToObject(
+ mojo, "sourceDirectory", new File(project.getBuild().getOutputDirectory()));
+ setVariableValueToObject(mojo, "jarName", DEFAULT_JAR_NAME);
+ setVariableValueToObject(mojo, "ejbJar", EjbMojo.DEFAULT_EJBJAR);
+ setVariableValueToObject(mojo, "clientExcludes", clientExcludes);
+ setVariableValueToObject(mojo, "clientIncludes", clientIncludes);
+ setVariableValueToObject(mojo, "excludes", excludes);
+ setVariableValueToObject(mojo, "clientClassifier", EjbMojo.DEFAULT_CLIENT_CLASSIFIER);
return mojo;
}
- protected EjbMojo lookupMojoWithDefaultSettings( final MavenProject project )
- throws Exception
- {
- return lookupMojoWithSettings( project, new LinkedList<String>(), new LinkedList<String>(), null );
+ protected EjbMojo lookupMojoWithDefaultSettings(final MavenProject project) throws Exception {
+ return lookupMojoWithSettings(project, new LinkedList<>(), new LinkedList<>(), null);
}
- protected void assertJarCreation( final MavenProject project, boolean ejbJarCreated, boolean ejbClientJarCreated,
- String classifier )
- {
+ protected void assertJarCreation(
+ final MavenProject project, boolean ejbJarCreated, boolean ejbClientJarCreated, String classifier) {
String checkedJarFile;
String checkedClientJarFile;
- if ( classifier == null )
- {
+ if (classifier == null) {
checkedJarFile = project.getBuild().getDirectory() + "/" + DEFAULT_JAR_NAME + ".jar";
checkedClientJarFile = project.getBuild().getDirectory() + "/" + DEFAULT_JAR_NAME + "-client.jar";
- }
- else
- {
+ } else {
checkedJarFile = project.getBuild().getDirectory() + "/" + DEFAULT_JAR_NAME + "-" + classifier + ".jar";
checkedClientJarFile =
- project.getBuild().getDirectory() + "/" + DEFAULT_JAR_NAME + "-" + classifier + "-client.jar";
+ project.getBuild().getDirectory() + "/" + DEFAULT_JAR_NAME + "-" + classifier + "-client.jar";
}
- assertEquals( "Invalid value for ejb-jar creation", ejbJarCreated, FileUtils.fileExists( checkedJarFile ) );
- assertEquals( "Invalid value for ejb-jar client creation", ejbClientJarCreated,
- FileUtils.fileExists( checkedClientJarFile ) );
-
+ assertEquals("Invalid value for ejb-jar creation", ejbJarCreated, new File(checkedJarFile).exists());
+ assertEquals(
+ "Invalid value for ejb-jar client creation",
+ ejbClientJarCreated,
+ new File(checkedClientJarFile).exists());
}
- protected void assertJarCreation( final MavenProject project, boolean ejbJarCreated, boolean ejbClientJarCreated )
- {
- assertJarCreation( project, ejbJarCreated, ejbClientJarCreated, null );
-
+ protected void assertJarCreation(final MavenProject project, boolean ejbJarCreated, boolean ejbClientJarCreated) {
+ assertJarCreation(project, ejbJarCreated, ejbClientJarCreated, null);
}
- private void doAssertJarContent( final MavenProject project, final String fileName, final String[] expectedFiles,
- final String[] unexpectedFiles )
- throws IOException
- {
+ private void doAssertJarContent(
+ final MavenProject project,
+ final String fileName,
+ final String[] expectedFiles,
+ final String[] unexpectedFiles)
+ throws IOException {
String checkedJarFile = project.getBuild().getDirectory() + "/" + fileName;
- if ( expectedFiles != null )
- {
+ if (expectedFiles != null) {
final JarContentChecker inclusionChecker = new JarContentChecker();
// set expected jar contents
- for ( String expectedFile : expectedFiles )
- {
- inclusionChecker.addFile( new File( expectedFile ) );
+ for (String expectedFile : expectedFiles) {
+ inclusionChecker.addFile(new File(expectedFile));
}
- assertTrue( inclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
+ assertTrue(inclusionChecker.isOK(new JarFile(checkedJarFile)));
}
- if ( unexpectedFiles != null )
- {
+ if (unexpectedFiles != null) {
final JarContentChecker exclusionChecker = new JarContentChecker();
- for ( String unexpectedFile : unexpectedFiles )
- {
- exclusionChecker.addFile( new File( unexpectedFile ) );
+ for (String unexpectedFile : unexpectedFiles) {
+ exclusionChecker.addFile(new File(unexpectedFile));
}
- assertFalse( exclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
+ assertFalse(exclusionChecker.isOK(new JarFile(checkedJarFile)));
}
-
}
- protected void assertJarContent( final MavenProject project, final String[] expectedFiles,
- final String[] unexpectedFiles )
- throws IOException
- {
+ protected void assertJarContent(
+ final MavenProject project, final String[] expectedFiles, final String[] unexpectedFiles)
+ throws IOException {
- doAssertJarContent( project, DEFAULT_JAR_NAME + ".jar", expectedFiles, unexpectedFiles );
+ doAssertJarContent(project, DEFAULT_JAR_NAME + ".jar", expectedFiles, unexpectedFiles);
}
- protected void assertClientJarContent( final MavenProject project, final String[] expectedFiles,
- final String[] unexpectedFiles )
- throws IOException
- {
-
- doAssertJarContent( project, DEFAULT_JAR_NAME + "-client.jar", expectedFiles, unexpectedFiles );
+ protected void assertClientJarContent(
+ final MavenProject project, final String[] expectedFiles, final String[] unexpectedFiles)
+ throws IOException {
+ doAssertJarContent(project, DEFAULT_JAR_NAME + "-client.jar", expectedFiles, unexpectedFiles);
}
}
=====================================
src/test/java/org/apache/maven/plugins/ejb/IncludesExcludesTest.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.ejb;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,82 +16,84 @@ package org.apache.maven.plugins.ejb;
* specific language governing permissions and limitations
* under the License.
*/
-
+package org.apache.maven.plugins.ejb;
import java.util.Arrays;
import java.util.Collections;
-import org.junit.Assert;
import org.junit.Test;
-public class IncludesExcludesTest
-{
+import static org.junit.Assert.assertArrayEquals;
+
+public class IncludesExcludesTest {
@Test
- public void emptyListsShouldResultInZeroSizeResults()
- {
- IncludesExcludes ie = new IncludesExcludes( Collections.<String>emptyList(), Collections.<String>emptyList(),
- Collections.<String>emptyList(), Collections.<String>emptyList() );
+ public void emptyListsShouldResultInZeroSizeResults() {
+ IncludesExcludes ie = new IncludesExcludes(
+ Collections.<String>emptyList(), Collections.<String>emptyList(),
+ Collections.<String>emptyList(), Collections.<String>emptyList());
- Assert.assertArrayEquals( ie.resultingIncludes(), new String[0] );
- Assert.assertArrayEquals( ie.resultingExcludes(), new String[0] );
+ assertArrayEquals(new String[0], ie.resultingIncludes());
+ assertArrayEquals(new String[0], ie.resultingExcludes());
}
@Test
- public void nullForIncludesShouldResultInZeroSizeResults()
- {
- IncludesExcludes ie = new IncludesExcludes( null, Collections.<String>emptyList(),
- Collections.<String>emptyList(), Collections.<String>emptyList() );
-
- Assert.assertArrayEquals( ie.resultingIncludes(), new String[0] );
- Assert.assertArrayEquals( ie.resultingExcludes(), new String[0] );
+ public void nullForIncludesShouldResultInZeroSizeResults() {
+ IncludesExcludes ie = new IncludesExcludes(
+ null,
+ Collections.<String>emptyList(),
+ Collections.<String>emptyList(),
+ Collections.<String>emptyList());
+
+ assertArrayEquals(new String[0], ie.resultingIncludes());
+ assertArrayEquals(new String[0], ie.resultingExcludes());
}
@Test
- public void nullForExcludesShouldResultInZeroSizeResults()
- {
- IncludesExcludes ie = new IncludesExcludes( Collections.<String>emptyList(), null,
- Collections.<String>emptyList(), Collections.<String>emptyList() );
-
- Assert.assertArrayEquals( ie.resultingIncludes(), new String[0] );
- Assert.assertArrayEquals( ie.resultingExcludes(), new String[0] );
+ public void nullForExcludesShouldResultInZeroSizeResults() {
+ IncludesExcludes ie = new IncludesExcludes(
+ Collections.<String>emptyList(),
+ null,
+ Collections.<String>emptyList(),
+ Collections.<String>emptyList());
+
+ assertArrayEquals(new String[0], ie.resultingIncludes());
+ assertArrayEquals(new String[0], ie.resultingExcludes());
}
@Test
- public void nonNullForDefaultExcludesShouldResultInExcludesWithDefaultExcludes()
- {
- IncludesExcludes ie = new IncludesExcludes( null, null, Collections.<String>emptyList(),
- Arrays.asList( "**/package.html" ) );
+ public void nonNullForDefaultExcludesShouldResultInExcludesWithDefaultExcludes() {
+ IncludesExcludes ie =
+ new IncludesExcludes(null, null, Collections.<String>emptyList(), Arrays.asList("**/package.html"));
- Assert.assertArrayEquals( ie.resultingIncludes(), new String[0] );
- Assert.assertArrayEquals( ie.resultingExcludes(), new String[] { "**/package.html" } );
+ assertArrayEquals(new String[0], ie.resultingIncludes());
+ assertArrayEquals(new String[] {"**/package.html"}, ie.resultingExcludes());
}
@Test
- public void nonNullForDefaultIncludesShouldResultInIncludesWithDefaultIncludes()
- {
- IncludesExcludes ie = new IncludesExcludes( null, null, Arrays.asList( "**/package.html" ),
- Collections.<String>emptyList() );
+ public void nonNullForDefaultIncludesShouldResultInIncludesWithDefaultIncludes() {
+ IncludesExcludes ie =
+ new IncludesExcludes(null, null, Arrays.asList("**/package.html"), Collections.<String>emptyList());
- Assert.assertArrayEquals( ie.resultingIncludes(), new String[] { "**/package.html" } );
- Assert.assertArrayEquals( ie.resultingExcludes(), new String[0] );
+ assertArrayEquals(new String[] {"**/package.html"}, ie.resultingIncludes());
+ assertArrayEquals(new String[0], ie.resultingExcludes());
}
@Test
- public void nonNullIncludesShouldResultInTheSameIncludes()
- {
- IncludesExcludes ie = new IncludesExcludes( Arrays.asList( "**/package.html" ), null,
- Arrays.asList( "**/site.html" ), null );
+ public void nonNullIncludesShouldResultInTheSameIncludes() {
+ IncludesExcludes ie = new IncludesExcludes(
+ Arrays.asList("**/package.html"), null,
+ Arrays.asList("**/site.html"), null);
- Assert.assertArrayEquals( ie.resultingIncludes(), new String[] { "**/package.html" } );
+ assertArrayEquals(new String[] {"**/package.html"}, ie.resultingIncludes());
}
@Test
- public void nonNullExcludesShouldResultInTheSameExcludes()
- {
- IncludesExcludes ie = new IncludesExcludes( null, Arrays.asList( "**/package.html" ),
- null, Arrays.asList( "**/site.html" ) );
+ public void nonNullExcludesShouldResultInTheSameExcludes() {
+ IncludesExcludes ie = new IncludesExcludes(
+ null, Arrays.asList("**/package.html"),
+ null, Arrays.asList("**/site.html"));
- Assert.assertArrayEquals( ie.resultingExcludes(), new String[] { "**/package.html" } );
+ assertArrayEquals(new String[] {"**/package.html"}, ie.resultingExcludes());
}
}
=====================================
src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectBasicStub.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.ejb.stub;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.ejb.stub;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.ejb.stub;
import java.io.File;
import java.util.Collections;
@@ -35,9 +34,7 @@ import org.codehaus.plexus.util.FileUtils;
/**
* Stub
*/
-public class MavenProjectBasicStub
- extends MavenProject
-{
+public class MavenProjectBasicStub extends MavenProject {
protected String identifier;
protected String testRootDir;
@@ -52,11 +49,9 @@ public class MavenProjectBasicStub
protected DefaultArtifact artifact;
- public MavenProjectBasicStub( String id )
- throws Exception
- {
+ public MavenProjectBasicStub(String id) throws Exception {
// most values are hardcoded to have a controlled environment
- super( new ModelStub() );
+ super(new ModelStub());
model = (ModelStub) super.getModel();
properties = new Properties();
@@ -67,9 +62,8 @@ public class MavenProjectBasicStub
// set isolated root directory
testRootDir = PlexusTestCase.getBasedir() + "/target/test-classes/unit/test-dir/" + identifier;
- if ( !FileUtils.fileExists( testRootDir ) )
- {
- FileUtils.mkdir( testRootDir );
+ if (!new File(testRootDir).exists()) {
+ FileUtils.mkdir(testRootDir);
}
// this is ugly but needed to ensure that the copy constructor
@@ -77,94 +71,77 @@ public class MavenProjectBasicStub
initializeParentFields();
}
- public String getName()
- {
+ public String getName() {
return "Test Project " + identifier;
}
- public void setDescription( String desc )
- {
+ public void setDescription(String desc) {
description = desc;
}
- public Model getModel()
- {
+ public Model getModel() {
return model;
}
- public String getDescription()
- {
- if ( description == null )
- {
+ public String getDescription() {
+ if (description == null) {
return "this is a test project";
- }
- else
- {
+ } else {
return description;
}
}
- public File getBasedir()
- {
+ public File getBasedir() {
// create an isolated environment
// see setupTestEnvironment for details
- return new File( testRootDir );
+ return new File(testRootDir);
}
- public Artifact getArtifact()
- {
+ public Artifact getArtifact() {
return artifact;
}
- public String getGroupId()
- {
+ public String getGroupId() {
String groupId = getModel().getGroupId();
- if ( ( groupId == null ) && ( getModel().getParent() != null ) )
- {
+ if ((groupId == null) && (getModel().getParent() != null)) {
groupId = getModel().getParent().getGroupId();
}
return groupId;
}
- public String getArtifactId()
- {
+ public String getArtifactId() {
return getModel().getArtifactId();
}
- public String getPackaging()
- {
+ public String getPackaging() {
return "ejb";
}
- public String getVersion()
- {
+ public String getVersion() {
return identifier;
}
- public void addProperty( String key, String value )
- {
- properties.put( key, value );
+ public void addProperty(String key, String value) {
+ properties.put(key, value);
}
- public Properties getProperties()
- {
+ public Properties getProperties() {
return properties;
}
// to prevent the MavenProject copy constructor from blowing up
- private void initializeParentFields()
- {
+ private void initializeParentFields() {
// the pom should be located in the isolated dummy root
- super.setFile( new File( getBasedir(), "pom.xml" ) );
- super.setDependencyArtifacts( Collections.<Artifact>emptySet() );
- super.setArtifacts( Collections.<Artifact>emptySet() );
- super.setExtensionArtifacts( Collections.<Artifact>emptySet() );
- super.setRemoteArtifactRepositories( Collections.<ArtifactRepository>emptyList() );
- super.setPluginArtifactRepositories( Collections.<ArtifactRepository>emptyList() );
- super.setCollectedProjects( Collections.<MavenProject>emptyList() );
- super.setActiveProfiles( Collections.<Profile>emptyList() );
- super.setOriginalModel( null );
- super.setExecutionProject( this );
- super.setArtifact( artifact );
+ super.setFile(new File(getBasedir(), "pom.xml"));
+ super.setDependencyArtifacts(Collections.<Artifact>emptySet());
+ super.setArtifacts(Collections.<Artifact>emptySet());
+ super.setExtensionArtifacts(Collections.<Artifact>emptySet());
+ super.setRemoteArtifactRepositories(Collections.<ArtifactRepository>emptyList());
+ super.setPluginArtifactRepositories(Collections.<ArtifactRepository>emptyList());
+ super.setCollectedProjects(Collections.<MavenProject>emptyList());
+ super.setActiveProfiles(Collections.<Profile>emptyList());
+ super.setOriginalModel(null);
+ super.setExecutionProject(this);
+ super.setArtifact(artifact);
}
}
=====================================
src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectBuildStub.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.ejb.stub;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.ejb.stub;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.ejb.stub;
import java.io.File;
import java.io.FileOutputStream;
@@ -33,9 +32,7 @@ import org.codehaus.plexus.util.FileUtils;
/**
* Stub
*/
-public class MavenProjectBuildStub
- extends MavenProjectBasicStub
-{
+public class MavenProjectBuildStub extends MavenProjectBasicStub {
public static final int RESOURCES_FILE = 1;
public static final int ROOT_FILE = 2;
@@ -76,77 +73,64 @@ public class MavenProjectBuildStub
protected Map<String, String> dataMap;
- public MavenProjectBuildStub( String key )
- throws Exception
- {
- super( key );
+ public MavenProjectBuildStub(String key) throws Exception {
+ super(key);
this.build = new Build();
- this.resourcesFileList = new ArrayList<String>();
- this.sourceFileList = new ArrayList<String>();
- this.rootFileList = new ArrayList<String>();
- this.directoryList = new ArrayList<String>();
- this.targetClassesList = new ArrayList<String>();
- this.dataMap = new HashMap<String, String>();
+ this.resourcesFileList = new ArrayList<>();
+ this.sourceFileList = new ArrayList<>();
+ this.rootFileList = new ArrayList<>();
+ this.directoryList = new ArrayList<>();
+ this.targetClassesList = new ArrayList<>();
+ this.dataMap = new HashMap<>();
setupBuild();
- model.setBuild( build );
+ model.setBuild(build);
}
- public void addDirectory( String name )
- {
- if ( isValidPath( name ) )
- {
- directoryList.add( name );
+ public void addDirectory(String name) {
+ if (isValidPath(name)) {
+ directoryList.add(name);
}
}
- public void setOutputDirectory( String dir )
- {
+ public void setOutputDirectory(String dir) {
outputDirectory = buildDirectory + "/" + dir;
- build.setOutputDirectory( outputDirectory );
+ build.setOutputDirectory(outputDirectory);
}
- public void addFile( String name, int type )
- {
- if ( isValidPath( name ) )
- {
- List<String> list = getList( type );
+ public void addFile(String name, int type) {
+ if (isValidPath(name)) {
+ List<String> list = getList(type);
- list.add( name );
+ list.add(name);
}
}
- public void addFile( String name, String data, int type )
- {
- File fileName = new File( name );
+ public void addFile(String name, String data, int type) {
+ File fileName = new File(name);
- addFile( name, type );
- dataMap.put( fileName.getName(), data );
+ addFile(name, type);
+ dataMap.put(fileName.getName(), data);
}
- public String getOutputDirectory()
- {
+ public String getOutputDirectory() {
return outputDirectory;
}
- public String getTestOutputDirectory()
- {
+ public String getTestOutputDirectory() {
return testOutputDirectory;
}
- public String getResourcesDirectory()
- {
+ public String getResourcesDirectory() {
return resourcesDirectory;
}
- public String getTestResourcesDirectory()
- {
+ public String getTestResourcesDirectory() {
return testResourcesDirectory;
}
- public Build getBuild()
- {
+ public Build getBuild() {
return build;
}
@@ -156,20 +140,17 @@ public class MavenProjectBuildStub
* @param path
* @return
*/
- private boolean isValidPath( String path )
- {
+ private boolean isValidPath(String path) {
boolean bRetVal = true;
- if ( path.startsWith( "c:" ) || path.startsWith( ".." ) || path.startsWith( "/" ) || path.startsWith( "\\" ) )
- {
+ if (path.startsWith("c:") || path.startsWith("..") || path.startsWith("/") || path.startsWith("\\")) {
bRetVal = false;
}
return bRetVal;
}
- private void setupBuild()
- {
+ private void setupBuild() {
// check getBasedir method for the exact path
// we need to recreate the dir structure in
// an isolated environment
@@ -180,74 +161,62 @@ public class MavenProjectBuildStub
resourcesDirectory = srcDirectory + "/main/resources/";
testResourcesDirectory = srcDirectory + "/test/resources/";
- build.setDirectory( buildDirectory );
- build.setOutputDirectory( outputDirectory );
- build.setTestOutputDirectory( testOutputDirectory );
+ build.setDirectory(buildDirectory);
+ build.setOutputDirectory(outputDirectory);
+ build.setTestOutputDirectory(testOutputDirectory);
}
- public void setupBuildEnvironment()
- throws Exception
- {
+ public void setupBuildEnvironment() throws Exception {
// populate dummy resources and dummy test resources
// setup src dir
- if ( !FileUtils.fileExists( resourcesDirectory ) )
- {
- FileUtils.mkdir( resourcesDirectory );
+ if (!new File(resourcesDirectory).exists()) {
+ FileUtils.mkdir(resourcesDirectory);
}
- if ( !FileUtils.fileExists( testResourcesDirectory ) )
- {
- FileUtils.mkdir( testResourcesDirectory );
+ if (!new File(testResourcesDirectory).exists()) {
+ FileUtils.mkdir(testResourcesDirectory);
}
- createDirectories( resourcesDirectory, testResourcesDirectory );
- createFiles( resourcesDirectory, testResourcesDirectory );
+ createDirectories(resourcesDirectory, testResourcesDirectory);
+ createFiles(resourcesDirectory, testResourcesDirectory);
setupRootFiles();
// setup target dir
- if ( !FileUtils.fileExists( outputDirectory ) )
- {
- FileUtils.mkdir( outputDirectory );
+ if (!new File(outputDirectory).exists()) {
+ FileUtils.mkdir(outputDirectory);
}
- if ( !FileUtils.fileExists( testOutputDirectory ) )
- {
- FileUtils.mkdir( testOutputDirectory );
+ if (!new File(testOutputDirectory).exists()) {
+ FileUtils.mkdir(testOutputDirectory);
}
setupTargetFiles();
}
- private void createDirectories( String parent, String testparent )
- {
+ private void createDirectories(String parent, String testparent) {
File currentDirectory;
- for ( Object aDirectoryList : directoryList )
- {
- currentDirectory = new File( parent, "/" + aDirectoryList );
+ for (Object aDirectoryList : directoryList) {
+ currentDirectory = new File(parent, "/" + aDirectoryList);
- if ( !currentDirectory.exists() )
- {
+ if (!currentDirectory.exists()) {
currentDirectory.mkdirs();
}
// duplicate dir structure in test resources
- currentDirectory = new File( testparent, "/" + aDirectoryList );
+ currentDirectory = new File(testparent, "/" + aDirectoryList);
- if ( !currentDirectory.exists() )
- {
+ if (!currentDirectory.exists()) {
currentDirectory.mkdirs();
}
}
}
- private List<String> getList( int type )
- {
+ private List<String> getList(int type) {
List<String> retVal = null;
- switch ( type )
- {
+ switch (type) {
case SOURCE_FILE:
retVal = sourceFileList;
break;
@@ -260,80 +229,66 @@ public class MavenProjectBuildStub
case ROOT_FILE:
retVal = rootFileList;
break;
+ default:
+ // do nothing
}
return retVal;
}
- private void createFiles( String parent, int type )
- {
+ private void createFiles(String parent, int type) {
File currentFile;
- List<String> list = getList( type );
+ List<String> list = getList(type);
// guard
- if ( list == null )
- {
+ if (list == null) {
return;
}
- for ( String aList : list )
- {
- currentFile = new File( parent, aList );
+ for (String aList : list) {
+ currentFile = new File(parent, aList);
// create the necessary parent directories
// before we create the files
- if ( !currentFile.getParentFile().exists() )
- {
+ if (!currentFile.getParentFile().exists()) {
currentFile.getParentFile().mkdirs();
}
- if ( !currentFile.exists() )
- {
- try
- {
+ if (!currentFile.exists()) {
+ try {
currentFile.createNewFile();
- populateFile( currentFile, RESOURCES_FILE );
- }
- catch ( IOException io )
- {
+ populateFile(currentFile, RESOURCES_FILE);
+ } catch (IOException io) {
// TODO: handle exception
}
}
}
}
- private void setupRootFiles()
- {
- createFiles( testRootDir, ROOT_FILE );
+ private void setupRootFiles() {
+ createFiles(testRootDir, ROOT_FILE);
}
- private void setupTargetFiles()
- {
- createFiles( getOutputDirectory(), OUTPUT_FILE );
+ private void setupTargetFiles() {
+ createFiles(getOutputDirectory(), OUTPUT_FILE);
}
- private void createFiles( String parent, String testparent )
- {
- createFiles( parent, RESOURCES_FILE );
- createFiles( testparent, RESOURCES_FILE );
+ private void createFiles(String parent, String testparent) {
+ createFiles(parent, RESOURCES_FILE);
+ createFiles(testparent, RESOURCES_FILE);
}
- private void populateFile( File file, int type )
- {
+ private void populateFile(File file, int type) {
FileOutputStream outputStream;
- String data = (String) dataMap.get( file.getName() );
-
- if ( ( data != null ) && file.exists() )
- {
- try
- {
- outputStream = new FileOutputStream( file );
- outputStream.write( data.getBytes() );
+ String data = (String) dataMap.get(file.getName());
+
+ if ((data != null) && file.exists()) {
+ try {
+ outputStream = new FileOutputStream(file);
+ outputStream.write(data.getBytes());
outputStream.flush();
outputStream.close();
- }
- catch ( IOException ex )
- {
+ } catch (IOException ex) {
// TODO: handle exception here
}
}
=====================================
src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectResourcesStub.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.ejb.stub;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,97 +16,82 @@ package org.apache.maven.plugins.ejb.stub;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.ejb.stub;
import org.apache.maven.model.Resource;
/**
* Stub
*/
-public class MavenProjectResourcesStub
- extends MavenProjectBuildStub
-{
-
- public MavenProjectResourcesStub( String id )
- throws Exception
- {
- super( id );
+public class MavenProjectResourcesStub extends MavenProjectBuildStub {
+
+ public MavenProjectResourcesStub(String id) throws Exception {
+ super(id);
setupResources();
setupTestResources();
}
- public void addInclude( String pattern )
- {
- ( (Resource) build.getResources().get( 0 ) ).addInclude( pattern );
+ public void addInclude(String pattern) {
+ ((Resource) build.getResources().get(0)).addInclude(pattern);
}
- public void addExclude( String pattern )
- {
- ( (Resource) build.getResources().get( 0 ) ).addExclude( pattern );
+ public void addExclude(String pattern) {
+ ((Resource) build.getResources().get(0)).addExclude(pattern);
}
- public void addTestInclude( String pattern )
- {
- ( (Resource) build.getTestResources().get( 0 ) ).addInclude( pattern );
+ public void addTestInclude(String pattern) {
+ ((Resource) build.getTestResources().get(0)).addInclude(pattern);
}
- public void addTestExclude( String pattern )
- {
- ( (Resource) build.getTestResources().get( 0 ) ).addExclude( pattern );
+ public void addTestExclude(String pattern) {
+ ((Resource) build.getTestResources().get(0)).addExclude(pattern);
}
- public void setTargetPath( String path )
- {
- ( (Resource) build.getResources().get( 0 ) ).setTargetPath( path );
+ public void setTargetPath(String path) {
+ ((Resource) build.getResources().get(0)).setTargetPath(path);
}
- public void setTestTargetPath( String path )
- {
- ( (Resource) build.getTestResources().get( 0 ) ).setTargetPath( path );
+ public void setTestTargetPath(String path) {
+ ((Resource) build.getTestResources().get(0)).setTargetPath(path);
}
- public void setDirectory( String dir )
- {
- ( (Resource) build.getResources().get( 0 ) ).setDirectory( dir );
+ public void setDirectory(String dir) {
+ ((Resource) build.getResources().get(0)).setDirectory(dir);
}
- public void setTestDirectory( String dir )
- {
- ( (Resource) build.getTestResources().get( 0 ) ).setDirectory( dir );
+ public void setTestDirectory(String dir) {
+ ((Resource) build.getTestResources().get(0)).setDirectory(dir);
}
- public void setResourceFiltering( int nIndex, boolean filter )
- {
- if ( build.getResources().size() > nIndex )
- {
- ( (Resource) build.getResources().get( nIndex ) ).setFiltering( filter );
+ public void setResourceFiltering(int nIndex, boolean filter) {
+ if (build.getResources().size() > nIndex) {
+ ((Resource) build.getResources().get(nIndex)).setFiltering(filter);
}
}
- private void setupResources()
- {
+ private void setupResources() {
Resource resource = new Resource();
// see MavenProjectBasicStub for details
// of getBasedir
// setup default resources
- resource.setDirectory( getBasedir().getPath() + "/src/main/resources" );
- resource.setFiltering( false );
- resource.setTargetPath( null );
- build.addResource( resource );
+ resource.setDirectory(getBasedir().getPath() + "/src/main/resources");
+ resource.setFiltering(false);
+ resource.setTargetPath(null);
+ build.addResource(resource);
}
- private void setupTestResources()
- {
+ private void setupTestResources() {
Resource resource = new Resource();
// see MavenProjectBasicStub for details
// of getBasedir
// setup default test resources
- resource.setDirectory( getBasedir().getPath() + "/src/test/resources" );
- resource.setFiltering( false );
- resource.setTargetPath( null );
- build.addTestResource( resource );
+ resource.setDirectory(getBasedir().getPath() + "/src/test/resources");
+ resource.setFiltering(false);
+ resource.setTargetPath(null);
+ build.addTestResource(resource);
}
}
=====================================
src/test/java/org/apache/maven/plugins/ejb/stub/ModelStub.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.ejb.stub;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.ejb.stub;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.ejb.stub;
import java.util.LinkedList;
import java.util.List;
@@ -30,62 +29,48 @@ import org.apache.maven.model.Profile;
/**
* Stub
*/
-public class ModelStub
- extends Model
-{
+public class ModelStub extends Model {
/**
- *
+ *
*/
private static final long serialVersionUID = -6823174384695495659L;
- public ModelStub()
- {
-
- }
+ public ModelStub() {}
- public String getVersion()
- {
+ public String getVersion() {
return "0.0-TEST";
}
- public String getModelVersion()
- {
+ public String getModelVersion() {
return "0.0-TEST";
}
- public String getName()
- {
+ public String getName() {
return "Test Model";
}
- public String getGroupId()
- {
+ public String getGroupId() {
return "org.apache.maven.test";
}
- public String getPackaging()
- {
+ public String getPackaging() {
return "jar";
}
- public Parent getParent()
- {
+ public Parent getParent() {
// return new Parent();
return null;
}
- public String getArtifactId()
- {
+ public String getArtifactId() {
return "maven-test-plugin";
}
- public Properties getProperties()
- {
+ public Properties getProperties() {
return new Properties();
}
- public List<Profile> getProfiles()
- {
- return new LinkedList<Profile>();
+ public List<Profile> getProfiles() {
+ return new LinkedList<>();
}
}
=====================================
src/test/java/org/apache/maven/plugins/ejb/utils/JarContentChecker.java
=====================================
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.ejb.utils;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.ejb.utils;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.ejb.utils;
import java.io.File;
import java.util.Enumeration;
@@ -30,31 +29,26 @@ import java.util.jar.JarFile;
/**
* Jar Content Checker
*/
-public class JarContentChecker
-{
- private final static Boolean FOUND = Boolean.TRUE;
+public class JarContentChecker {
+ private static final Boolean FOUND = Boolean.TRUE;
- private final static Boolean NOT_FOUND = Boolean.FALSE;
+ private static final Boolean NOT_FOUND = Boolean.FALSE;
private Map<File, Boolean> fileMap;
private Map<File, Boolean> directoryMap;
-
- public JarContentChecker()
- {
- fileMap = new HashMap<File, Boolean>();
- directoryMap = new HashMap<File, Boolean>();
+ public JarContentChecker() {
+ fileMap = new HashMap<>();
+ directoryMap = new HashMap<>();
}
- public void addDirectory( File dir )
- {
- directoryMap.put( dir, NOT_FOUND );
+ public void addDirectory(File dir) {
+ directoryMap.put(dir, NOT_FOUND);
}
- public void addFile( File file )
- {
- fileMap.put( file, NOT_FOUND );
+ public void addFile(File file) {
+ fileMap.put(file, NOT_FOUND);
}
/**
@@ -65,8 +59,7 @@ public class JarContentChecker
* @param jarFile the Jar file
* @return boolean
*/
- public boolean isOK( JarFile jarFile )
- {
+ public boolean isOK(JarFile jarFile) {
boolean bRetVal;
Enumeration<JarEntry> zipentries = jarFile.entries();
JarEntry entry;
@@ -74,24 +67,19 @@ public class JarContentChecker
resetList();
- while ( zipentries.hasMoreElements() )
- {
+ while (zipentries.hasMoreElements()) {
entry = zipentries.nextElement();
- entryFile = new File( entry.getName() );
+ entryFile = new File(entry.getName());
- if ( entry.isDirectory() )
- {
+ if (entry.isDirectory()) {
// cross out all files found in the jar file
// found files with incorrect content will not
// be counted
- if ( directoryMap.containsKey( entryFile ) )
- {
- directoryMap.put( entryFile, FOUND );
+ if (directoryMap.containsKey(entryFile)) {
+ directoryMap.put(entryFile, FOUND);
}
- }
- else if ( fileMap.containsKey( entryFile ) )
- {
- fileMap.put( entryFile, FOUND );
+ } else if (fileMap.containsKey(entryFile)) {
+ fileMap.put(entryFile, FOUND);
}
}
@@ -100,26 +88,21 @@ public class JarContentChecker
return bRetVal;
}
- private boolean checkFinalResult()
- {
+ private boolean checkFinalResult() {
boolean bRetVal = true;
Iterator<File> keys = fileMap.keySet().iterator();
- while ( keys.hasNext() && bRetVal )
- {
- if ( fileMap.get( keys.next() ).equals( NOT_FOUND ) )
- {
+ while (keys.hasNext() && bRetVal) {
+ if (fileMap.get(keys.next()).equals(NOT_FOUND)) {
bRetVal = false;
}
}
keys = directoryMap.keySet().iterator();
- while ( keys.hasNext() && bRetVal )
- {
- if ( directoryMap.get( keys.next() ).equals( NOT_FOUND ) )
- {
+ while (keys.hasNext() && bRetVal) {
+ if (directoryMap.get(keys.next()).equals(NOT_FOUND)) {
bRetVal = false;
}
}
@@ -127,20 +110,17 @@ public class JarContentChecker
return bRetVal;
}
- private void resetList()
- {
+ private void resetList() {
Iterator<File> keys = fileMap.keySet().iterator();
- while ( keys.hasNext() )
- {
- fileMap.put( keys.next(), NOT_FOUND );
+ while (keys.hasNext()) {
+ fileMap.put(keys.next(), NOT_FOUND);
}
keys = directoryMap.keySet().iterator();
- while ( keys.hasNext() )
- {
- directoryMap.put( keys.next(), NOT_FOUND );
+ while (keys.hasNext()) {
+ directoryMap.put(keys.next(), NOT_FOUND);
}
}
}
View it on GitLab: https://salsa.debian.org/java-team/maven-ejb-plugin/-/commit/2474c70b9c486f16cd135631f7e9852379d0c20a
--
View it on GitLab: https://salsa.debian.org/java-team/maven-ejb-plugin/-/commit/2474c70b9c486f16cd135631f7e9852379d0c20a
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20261029/ad7ebeb5/attachment.htm>
More information about the pkg-java-commits
mailing list