├── .asf.yaml ├── .github ├── ISSUE_TEMPLATE │ ├── BUG.yml │ ├── FEATURE.yml │ └── config.yml ├── dependabot.yml ├── pull_request_template.md ├── release-drafter.yml └── workflows │ ├── maven-verify.yml │ ├── pr-automation.yml │ ├── release-drafter.yml │ └── stale.yml ├── .gitignore ├── Jenkinsfile ├── README.md ├── pom.xml └── src ├── it ├── basic │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── Main.java ├── dependenciesToAnalyze │ ├── invoker.properties │ ├── pom.xml │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── Main.java │ └── verify.groovy ├── includeClasspath │ ├── invoker.properties │ ├── pom.xml │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── Main.java │ └── verify.groovy ├── module │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ ├── module-info.java │ │ └── org │ │ └── apache │ │ └── maven │ │ └── plugins │ │ └── jdeps │ │ └── its │ │ └── Main.java ├── multirelease │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── Main.java ├── package │ ├── invoker.properties │ ├── pom.xml │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── maven │ │ │ └── plugins │ │ │ └── jdeps │ │ │ └── its │ │ │ └── Main.java │ └── verify.groovy ├── settings.xml ├── unsupported-api_main │ ├── invoker.properties │ ├── pom.xml │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── Base64Codec.java │ └── verify.groovy └── unsupported-api_test │ ├── invoker.properties │ ├── pom.xml │ ├── src │ ├── main │ │ └── java │ │ │ └── Main.java │ └── test │ │ └── java │ │ └── Base64Codec.java │ └── verify.groovy ├── main └── java │ └── org │ └── apache │ └── maven │ └── plugins │ └── jdeps │ ├── AbstractJDepsMojo.java │ ├── JDKInternalsMojo.java │ ├── TestJDKInternalsMojo.java │ └── consumers │ └── JDepsConsumer.java ├── site ├── apt │ ├── index.apt.vm │ └── usage.apt.vm ├── resources │ └── download.cgi ├── site.xml └── xdoc │ └── download.xml.vm └── test └── java └── org └── apache └── maven └── plugins └── jdeps └── consumers └── JDepsConsumerTest.java /.asf.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # see https://s.apache.org/asfyaml 18 | github: 19 | description: "Apache Maven JDeps Plugin" 20 | homepage: https://maven.apache.org/plugins/maven-jdeps-plugin/ 21 | labels: 22 | - java 23 | - build-management 24 | - maven-plugins 25 | - maven-jdeps-plugin 26 | - maven 27 | enabled_merge_buttons: 28 | squash: true 29 | merge: false 30 | rebase: true 31 | autolink_jira: 32 | - MJDEPS 33 | del_branch_on_merge: true 34 | features: 35 | issues: true 36 | notifications: 37 | commits: commits@maven.apache.org 38 | issues: issues@maven.apache.org 39 | pullrequests: issues@maven.apache.org 40 | jira_options: link label comment 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BUG.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema 19 | 20 | name: Bug Report 21 | description: File a bug report 22 | labels: ["bug"] 23 | 24 | body: 25 | - type: markdown 26 | attributes: 27 | value: | 28 | Thanks for taking the time to fill out this bug report. 29 | 30 | Simple fixes in single PRs do not require issues. 31 | 32 | **Do you use the latest project version?** 33 | 34 | - type: input 35 | id: version 36 | attributes: 37 | label: Affected version 38 | validations: 39 | required: true 40 | 41 | - type: textarea 42 | id: message 43 | attributes: 44 | label: Bug description 45 | validations: 46 | required: true 47 | 48 | 49 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema 19 | 20 | name: Feature request 21 | description: File a proposal for new feature, improvement 22 | labels: ["enhancement"] 23 | 24 | body: 25 | - type: markdown 26 | attributes: 27 | value: | 28 | Thanks for taking the time to fill out this new feature, improvement proposal. 29 | 30 | - type: textarea 31 | id: message 32 | attributes: 33 | label: New feature, improvement proposal 34 | validations: 35 | required: true 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser 19 | 20 | blank_issues_enabled: false 21 | 22 | contact_links: 23 | 24 | - name: Project Mailing Lists 25 | url: https://maven.apache.org/mailing-lists.html 26 | about: Please ask a question or discuss here 27 | 28 | - name: Old JIRA Issues 29 | url: https://issues.apache.org/jira/projects/MJDEP 30 | about: Please search old JIRA issues 31 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | version: 2 18 | updates: 19 | - package-ecosystem: "maven" 20 | directory: "/" 21 | schedule: 22 | interval: "daily" 23 | - package-ecosystem: "github-actions" 24 | directory: "/" 25 | schedule: 26 | interval: "daily" 27 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | Following this checklist to help us incorporate your 2 | contribution quickly and easily: 3 | 4 | - [ ] Your pull request should address just one issue, without pulling in other changes. 5 | - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. 6 | - [ ] Each commit in the pull request should have a meaningful subject line and body. 7 | Note that commits might be squashed by a maintainer on merge. 8 | - [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. 9 | This may not always be possible but is a best-practice. 10 | - [ ] Run `mvn verify` to make sure basic checks pass. 11 | A more thorough check will be performed on your pull request automatically. 12 | - [ ] You have run the integration tests successfully (`mvn -Prun-its verify`). 13 | 14 | If your pull request is about ~20 lines of code you don't need to sign an 15 | [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure 16 | please ask on the developers list. 17 | 18 | To make clear that you license your contribution under 19 | the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) 20 | you have to acknowledge this by using the following check-box. 21 | 22 | - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) 23 | - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). 24 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | _extends: maven-gh-actions-shared 19 | -------------------------------------------------------------------------------- /.github/workflows/maven-verify.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: Verify 19 | 20 | on: 21 | push: 22 | pull_request: 23 | 24 | jobs: 25 | build: 26 | name: Verify 27 | uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4 28 | with: 29 | jdk-distribution-matrix: '[ "zulu", "microsoft", "liberica", "adopt-openj9" ]' 30 | matrix-exclude: '[{ "jdk": "8", "distribution": "microsoft"},{ "jdk": "8", "os": "macos-latest"}]' 31 | -------------------------------------------------------------------------------- /.github/workflows/pr-automation.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: PR Automation 19 | on: 20 | pull_request_target: 21 | types: 22 | - closed 23 | 24 | jobs: 25 | pr-automation: 26 | name: PR Automation 27 | uses: apache/maven-gh-actions-shared/.github/workflows/pr-automation.yml@v4 28 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: Release Drafter 19 | on: 20 | push: 21 | branches: 22 | - master 23 | workflow_dispatch: 24 | 25 | jobs: 26 | update_release_draft: 27 | uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v4 28 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: Stale 19 | 20 | on: 21 | schedule: 22 | - cron: '12 1 * * *' 23 | issue_comment: 24 | types: [ 'created' ] 25 | 26 | jobs: 27 | stale: 28 | uses: 'apache/maven-gh-actions-shared/.github/workflows/stale.yml@v4' 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .project 3 | .classpath 4 | .settings/ 5 | .svn/ 6 | bin/ 7 | # Intellij 8 | *.ipr 9 | *.iml 10 | .idea 11 | out/ 12 | .DS_Store 13 | /bootstrap 14 | /dependencies.xml 15 | .java-version 16 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | asfMavenTlpPlgnBuild() 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 17 | Contributing to [Apache Maven JDeps Plugin](https://maven.apache.org/plugins/maven-jdeps-plugin/) 18 | ====================== 19 | 20 | [![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license] 21 | [![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.plugins/maven-jdeps-plugin.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.apache.maven.plugins/maven-jdeps-plugin) 22 | [![Jenkins Status](https://img.shields.io/jenkins/s/https/ci-maven.apache.org/job/Maven/job/maven-box/job/maven-jdeps-plugin/job/master.svg?)][build] 23 | [![Jenkins tests](https://img.shields.io/jenkins/t/https/ci-maven.apache.org/job/Maven/job/maven-box/job/maven-jdeps-plugin/job/master.svg?)][test-results] 24 | 25 | 26 | You have found a bug, or you have an idea for a cool new feature? Contributing 27 | code is a great way to give something back to the open source community. Before 28 | you dig right into the code, there are a few guidelines that we need 29 | contributors to follow so that we can have a chance of keeping on top of 30 | things. 31 | 32 | Getting Started 33 | --------------- 34 | 35 | + Make sure you have a [GitHub account](https://github.com/signup/free). 36 | + If you're planning to implement a new feature, it makes sense to discuss your changes 37 | on the [dev list][ml-list] first. 38 | This way you can make sure you're not wasting your time on something that isn't 39 | considered to be in Apache Maven's scope. 40 | + Submit a ticket for your issue, assuming one does not already exist. 41 | + Clearly describe the issue, including steps to reproduce when it is a bug. 42 | + Make sure you fill in the earliest version that you know has the issue. 43 | + Fork the repository on GitHub. 44 | 45 | Making and Submitting Changes 46 | -------------- 47 | 48 | We accept Pull Requests via GitHub. The [developer mailing list][ml-list] is the 49 | main channel of communication for contributors. 50 | There are some guidelines which will make applying PRs easier for us: 51 | + Create a topic branch from where you want to base your work (this is usually the master branch). 52 | Push your changes to a topic branch in your fork of the repository. 53 | + Make commits of logical units. 54 | + Respect the original code style: by using the same [codestyle][code-style], 55 | patches should only highlight the actual difference, not being disturbed by any formatting issues: 56 | + Only use spaces for indentation. 57 | + Create minimal diffs - disable on save actions like reformat source code or organize imports. 58 | If you feel the source code should be reformatted, create a separate PR for this change. 59 | + Check for unnecessary whitespace with `git diff --check` before committing. 60 | + Make sure you have added the necessary tests (JUnit/IT) for your changes. 61 | + Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken. 62 | + Submit a pull request to the repository in the Apache organization. 63 | 64 | If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla]. 65 | 66 | Additional Resources 67 | -------------------- 68 | 69 | + [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch) 70 | + [Contributor License Agreement][cla] 71 | + [General GitHub documentation](https://help.github.com/) 72 | + [GitHub pull request documentation](https://help.github.com/send-pull-requests/) 73 | + [Apache Maven X Account](https://x.com/ASFMavenProject) 74 | + [Apache Maven Bluesky Account](https://bsky.app/profile/maven.apache.org) 75 | + [Apache Maven Mastodon Account](https://mastodon.social/deck/@ASFMavenProject@fosstodon.org) 76 | 77 | [license]: https://www.apache.org/licenses/LICENSE-2.0 78 | [ml-list]: https://maven.apache.org/mailing-lists.html 79 | [code-style]: https://maven.apache.org/developers/conventions/code.html 80 | [cla]: https://www.apache.org/licenses/#clas 81 | [maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index 82 | [test-results]: https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-jdeps-plugin/job/master/lastCompletedBuild/testReport/ 83 | [build]: https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-jdeps-plugin/job/master/ 84 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 4.0.0 22 | 23 | 24 | org.apache.maven.plugins 25 | maven-plugins 26 | 43 27 | 28 | 29 | 30 | maven-jdeps-plugin 31 | 3.2.0-SNAPSHOT 32 | maven-plugin 33 | 34 | Apache Maven JDeps Plugin 35 | The JDeps Plugin uses the jdeps tool to analyze classes for internal API calls. 36 | 2015 37 | 38 | 39 | 40 | Andrea Nenni 41 | 42 | 43 | 44 | 45 | 3.6.3 46 | 47 | 48 | 49 | scm:git:https://gitbox.apache.org/repos/asf/maven-jdeps-plugin.git 50 | scm:git:https://gitbox.apache.org/repos/asf/maven-jdeps-plugin.git 51 | HEAD 52 | https://github.com/apache/maven-jdeps-plugin/tree/${project.scm.tag} 53 | 54 | 55 | GitHub Issues 56 | https://github.com/apache/maven-jdeps-plugin/issues 57 | 58 | 59 | Jenkins 60 | https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-jdeps-plugin/ 61 | 62 | 63 | 64 | apache.website 65 | scm:svn:https://svn.apache.org/repos/asf/maven/website/components/${maven.site.path} 66 | 67 | 68 | 69 | 70 | 3.9.9 71 | 8 72 | 2020-04-07T21:04:00Z 73 | 74 | 75 | 76 | 77 | org.apache.maven.plugin-tools 78 | maven-plugin-annotations 79 | provided 80 | 81 | 82 | javax.inject 83 | javax.inject 84 | 1 85 | provided 86 | 87 | 88 | 89 | org.apache.maven 90 | maven-plugin-api 91 | ${mavenVersion} 92 | provided 93 | 94 | 95 | org.apache.maven 96 | maven-core 97 | ${mavenVersion} 98 | provided 99 | 100 | 101 | org.apache.maven 102 | maven-model 103 | ${mavenVersion} 104 | provided 105 | 106 | 107 | org.codehaus.plexus 108 | plexus-utils 109 | 110 | 111 | org.apache.commons 112 | commons-lang3 113 | 3.17.0 114 | 115 | 116 | 117 | 118 | org.junit.jupiter 119 | junit-jupiter-api 120 | test 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /src/it/basic/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.goals=process-classes 19 | -------------------------------------------------------------------------------- /src/it/basic/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 24 | 4.0.0 25 | 26 | org.apache.maven.plugins.jdeps.its 27 | basic 28 | 1.0-SNAPSHOT 29 | 30 | 31 | 1.6 32 | 1.6 33 | 34 | 35 | 36 | 37 | 38 | @project.groupId@ 39 | @project.artifactId@ 40 | @project.version@ 41 | 42 | 43 | 44 | jdkinternals 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/it/basic/src/main/java/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class Main 21 | { 22 | public static void main( String[] args ) 23 | { 24 | System.out.println( "Hello World!" ); 25 | } 26 | } -------------------------------------------------------------------------------- /src/it/dependenciesToAnalyze/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.goals=process-classes 19 | -------------------------------------------------------------------------------- /src/it/dependenciesToAnalyze/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 24 | 4.0.0 25 | 26 | org.apache.maven.plugins.jdeps.its 27 | basic 28 | 1.0-SNAPSHOT 29 | 30 | 31 | 1.6 32 | 1.6 33 | 34 | 35 | 36 | 37 | 38 | @project.groupId@ 39 | @project.artifactId@ 40 | @project.version@ 41 | 42 | 43 | 44 | jdkinternals 45 | 46 | 47 | false 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | org.codehaus.plexus 58 | plexus-utils 59 | 3.0.24 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/it/dependenciesToAnalyze/src/main/java/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class Main 21 | { 22 | public static void main( String[] args ) 23 | { 24 | for ( String validFamily : org.codehaus.plexus.util.Os.getValidFamilies() ) 25 | { 26 | System.out.println( validFamily ); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/it/dependenciesToAnalyze/verify.groovy: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | def buildLog = new File( basedir, 'build.log' ) 22 | 23 | def found = false; 24 | 25 | assert buildLog.readLines().each { String line -> 26 | 27 | if ( line.startsWith( '[DEBUG] Executing: ' ) ) 28 | { 29 | assert line.count( "classes" ) == 1 : "invalid classes count: " + line.count( "classes" ) 30 | 31 | assert line.count( "plexus-utils-3.0.24.jar" ) == 1 : "invalid plexus-utils-3.0.24.jar count: " + line.count( "plexus-utils-3.0.24.jar" ) 32 | 33 | found = true; 34 | } 35 | } 36 | 37 | assert found == true : "Executing line not found" 38 | -------------------------------------------------------------------------------- /src/it/includeClasspath/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.goals=process-classes 19 | invoker.buildResult=failure 20 | -------------------------------------------------------------------------------- /src/it/includeClasspath/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 24 | 4.0.0 25 | 26 | org.apache.maven.plugins.jdeps.its 27 | basic 28 | 1.0-SNAPSHOT 29 | 30 | 31 | 1.6 32 | 1.6 33 | 34 | 35 | 36 | 37 | 38 | @project.groupId@ 39 | @project.artifactId@ 40 | @project.version@ 41 | 42 | 43 | 44 | jdkinternals 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | com.google.guava 56 | guava 57 | 32.0.0-jre 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/it/includeClasspath/src/main/java/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class Main 21 | { 22 | public static void main( String[] args ) 23 | { 24 | } 25 | } -------------------------------------------------------------------------------- /src/it/includeClasspath/verify.groovy: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | def buildLog = new File( basedir, 'build.log' ) 22 | 23 | def found = false; 24 | 25 | buildLog.readLines().each { String line -> 26 | 27 | if ( line.contains( 'Found offending packages' ) ) 28 | { 29 | found = true; 30 | } 31 | } 32 | 33 | assert found : "No offending packages" 34 | -------------------------------------------------------------------------------- /src/it/module/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.java.version=9+ 19 | invoker.goals=process-classes 20 | -------------------------------------------------------------------------------- /src/it/module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 24 | 4.0.0 25 | 26 | org.apache.maven.plugins.jdeps.its 27 | basic 28 | 1.0-SNAPSHOT 29 | 30 | 31 | 9 32 | 33 | 34 | 35 | 36 | 37 | 38 | org.apache.maven.plugins 39 | maven-compiler-plugin 40 | 3.7.0 41 | 42 | 43 | 44 | 45 | 46 | @project.groupId@ 47 | @project.artifactId@ 48 | @project.version@ 49 | 50 | 51 | 52 | jdkinternals 53 | 54 | 55 | 56 | 57 | maven.its.base 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/it/module/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | module maven.its.base {} -------------------------------------------------------------------------------- /src/it/module/src/main/java/org/apache/maven/plugins/jdeps/its/Main.java: -------------------------------------------------------------------------------- 1 | package org.apache.maven.plugins.jdeps.its; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | public class Main 23 | { 24 | public static void main( String[] args ) 25 | { 26 | System.out.println( "Hello World!" ); 27 | } 28 | } -------------------------------------------------------------------------------- /src/it/multirelease/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.java.version=9+ 19 | invoker.goals=process-classes 20 | -------------------------------------------------------------------------------- /src/it/multirelease/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 24 | 4.0.0 25 | 26 | org.apache.maven.plugins.jdeps.its 27 | multirelease 28 | 1.0-SNAPSHOT 29 | 30 | 31 | 1.6 32 | 1.6 33 | 34 | 35 | 36 | 37 | 38 | @project.groupId@ 39 | @project.artifactId@ 40 | @project.version@ 41 | 42 | 43 | 44 | jdkinternals 45 | 46 | 47 | 48 | 49 | base 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | org.apache.logging.log4j 58 | log4j-api 59 | 2.9.0 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/it/multirelease/src/main/java/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import org.apache.logging.log4j.LogManager; 21 | 22 | public class Main 23 | { 24 | public static void main( String[] args ) 25 | { 26 | LogManager.getLogger().info( "Hello World!" ); 27 | } 28 | } -------------------------------------------------------------------------------- /src/it/package/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.goals=process-classes 19 | -------------------------------------------------------------------------------- /src/it/package/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 24 | 4.0.0 25 | 26 | org.apache.maven.plugins.jdeps.its 27 | package 28 | 1.0-SNAPSHOT 29 | 30 | https://issues.apache.org/jira/browse/MJDEPS-12 31 | 32 | 33 | 1.6 34 | 1.6 35 | 36 | 37 | 38 | 39 | 40 | @project.groupId@ 41 | @project.artifactId@ 42 | @project.version@ 43 | 44 | 45 | 46 | jdkinternals 47 | 48 | 49 | 50 | 51 | 52 | java.io 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/it/package/src/main/java/org/apache/maven/plugins/jdeps/its/Main.java: -------------------------------------------------------------------------------- 1 | package org.apache.maven.plugins.jdeps.its; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | public class Main 23 | { 24 | public static void main( String[] args ) 25 | { 26 | System.out.println( "Hello World!" ); 27 | } 28 | } -------------------------------------------------------------------------------- /src/it/package/verify.groovy: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | def buildLog = new File( basedir, 'build.log' ) 22 | 23 | def lines = buildLog.readLines().dropWhile{ !it.startsWith("classes -> ") }.takeWhile{ !it.startsWith( '[INFO]' ) } 24 | 25 | // classes -> java.base 26 | // org.apache.maven.plugins.jdeps.its -> java.io java.base 27 | 28 | // classes -> c:\Program Files\Java\jdk1.8.0_152\jre\lib\rt.jar 29 | // org.apache.maven.plugins.jdeps.its (classes) 30 | // -> java.io 31 | 32 | assert lines.size() == ( lines[0] == 'classes -> java.base' ? 2 : 3 ) 33 | -------------------------------------------------------------------------------- /src/it/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | it-repo 26 | 27 | 28 | local.central 29 | @localRepositoryUrl@ 30 | 31 | true 32 | 33 | 34 | true 35 | 36 | 37 | 38 | 39 | 40 | local.central 41 | @localRepositoryUrl@ 42 | 43 | true 44 | 45 | 46 | true 47 | 48 | 49 | 50 | 51 | 52 | 53 | it-repo 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/it/unsupported-api_main/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.java.version=8 19 | invoker.goals=process-classes 20 | invoker.buildResult=failure 21 | -------------------------------------------------------------------------------- /src/it/unsupported-api_main/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 24 | 4.0.0 25 | 26 | org.apache.maven.plugins.jdeps.its 27 | unsupported-api 28 | 1.0-SNAPSHOT 29 | 30 | 31 | 1.6 32 | 1.6 33 | 34 | 35 | 36 | 37 | 38 | @project.groupId@ 39 | @project.artifactId@ 40 | @project.version@ 41 | 42 | 43 | 44 | jdkinternals 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/it/unsupported-api_main/src/main/java/Base64Codec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import java.io.IOException; 21 | 22 | public class Base64Codec 23 | { 24 | 25 | @SuppressWarnings( "restriction" ) 26 | public static byte[] Base64decode( String input ) throws IOException 27 | { 28 | return new sun.misc.BASE64Decoder().decodeBuffer( input ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/it/unsupported-api_main/verify.groovy: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | def buildLog = new File( basedir, 'build.log' ) 22 | 23 | assert buildLog.readLines().dropWhile{ !(it =~ /Found offending packages\:$/) }.getAt(1) ==~ /\[ERROR\]\s+sun\.misc -> JDK (removed )?internal API.*/ 24 | -------------------------------------------------------------------------------- /src/it/unsupported-api_test/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.java.version=8 19 | invoker.goals.1=process-classes 20 | invoker.buildResult.1=success 21 | 22 | invoker.goals.2=process-test-classes 23 | invoker.buildResult.2=failure 24 | -------------------------------------------------------------------------------- /src/it/unsupported-api_test/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 24 | 4.0.0 25 | 26 | org.apache.maven.plugins.jdeps.its 27 | unsupported-api 28 | 1.0-SNAPSHOT 29 | 30 | 31 | 1.6 32 | 1.6 33 | 34 | 35 | 36 | 37 | 38 | @project.groupId@ 39 | @project.artifactId@ 40 | @project.version@ 41 | 42 | 43 | 44 | jdkinternals 45 | test-jdkinternals 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/it/unsupported-api_test/src/main/java/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class Main 21 | { 22 | 23 | public static void main( String[] args ) 24 | { 25 | System.out.println( "Hello world!" ); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/it/unsupported-api_test/src/test/java/Base64Codec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import java.io.IOException; 21 | 22 | public class Base64Codec 23 | { 24 | 25 | @SuppressWarnings( "restriction" ) 26 | public static byte[] Base64decode( String input ) throws IOException 27 | { 28 | return new sun.misc.BASE64Decoder().decodeBuffer( input ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/it/unsupported-api_test/verify.groovy: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | def buildLog = new File( basedir, 'build.log' ) 22 | 23 | assert buildLog.readLines().dropWhile{ !(it =~ /Found offending packages\:$/) }.getAt(1) ==~ /\[ERROR\]\s+sun\.misc -> JDK (removed )?internal API.*/ -------------------------------------------------------------------------------- /src/main/java/org/apache/maven/plugins/jdeps/AbstractJDepsMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | package org.apache.maven.plugins.jdeps; 20 | 21 | import java.io.File; 22 | import java.io.IOException; 23 | import java.lang.reflect.InvocationTargetException; 24 | import java.lang.reflect.Method; 25 | import java.nio.file.Path; 26 | import java.nio.file.Paths; 27 | import java.util.ArrayList; 28 | import java.util.Collection; 29 | import java.util.Collections; 30 | import java.util.LinkedHashSet; 31 | import java.util.List; 32 | import java.util.Map; 33 | import java.util.Properties; 34 | import java.util.Set; 35 | import java.util.StringTokenizer; 36 | 37 | import org.apache.commons.lang3.StringUtils; 38 | import org.apache.commons.lang3.SystemUtils; 39 | import org.apache.maven.artifact.Artifact; 40 | import org.apache.maven.artifact.ArtifactUtils; 41 | import org.apache.maven.artifact.DependencyResolutionRequiredException; 42 | import org.apache.maven.execution.MavenSession; 43 | import org.apache.maven.plugin.AbstractMojo; 44 | import org.apache.maven.plugin.MojoExecutionException; 45 | import org.apache.maven.plugin.MojoFailureException; 46 | import org.apache.maven.plugins.annotations.Parameter; 47 | import org.apache.maven.plugins.jdeps.consumers.JDepsConsumer; 48 | import org.apache.maven.project.MavenProject; 49 | import org.apache.maven.toolchain.Toolchain; 50 | import org.apache.maven.toolchain.ToolchainManager; 51 | import org.codehaus.plexus.util.MatchPatterns; 52 | import org.codehaus.plexus.util.cli.CommandLineException; 53 | import org.codehaus.plexus.util.cli.CommandLineUtils; 54 | import org.codehaus.plexus.util.cli.Commandline; 55 | 56 | /** 57 | * Abstract Mojo for JDeps 58 | * 59 | * @author Robert Scholte 60 | * 61 | */ 62 | public abstract class AbstractJDepsMojo extends AbstractMojo { 63 | 64 | @Parameter(defaultValue = "${project}", readonly = true, required = true) 65 | private MavenProject project; 66 | 67 | @Parameter(defaultValue = "${session}", readonly = true, required = true) 68 | private MavenSession session; 69 | 70 | @Parameter(defaultValue = "${project.build.directory}", readonly = true, required = true) 71 | private File outputDirectory; 72 | 73 | /** 74 | * Indicates whether the build will continue even if there are jdeps warnings. 75 | */ 76 | @Parameter(defaultValue = "true", property = "jdeps.failOnWarning") 77 | private boolean failOnWarning; 78 | 79 | /** 80 | * Specifies the version when processing multi-release JAR files version should be an integer >=9 or base. 81 | * 82 | * @since 3.1.1 83 | */ 84 | @Parameter(property = "jdeps.multiRelease") 85 | private String multiRelease; 86 | 87 | /** 88 | * Whether only the sources need to be compatible or also every dependency on the classpath. 89 | * 90 | * @since 3.1.3 91 | */ 92 | @Parameter(defaultValue = "true", property = "jdeps.includeClasspath") 93 | private boolean includeClasspath; 94 | 95 | /** 96 | * Additional dependencies which should be analyzed besides the classes. 97 | * Specify as {@code groupId:artifactId}, allowing ant-pattern. 98 | * 99 | * E.g. 100 | *
101 |      *   <dependenciesToAnalyzeIncludes>
102 |      *     <include>*:*</include>
103 |      *     <include>org.foo.*:*</include>
104 |      *     <include>com.foo.bar:*</include>
105 |      *     <include>dot.foo.bar:utilities</include>
106 |      *   </dependenciesToAnalyzeIncludes>
107 |      * 
108 | */ 109 | @Parameter 110 | private List dependenciesToAnalyzeIncludes; 111 | 112 | /** 113 | * Subset of {@link AbstractJDepsMojo#dependenciesToAnalyzeIncludes} which should be not analyzed. 114 | * Specify as {@code groupId:artifactId}, allowing ant-pattern. 115 | * 116 | * E.g. 117 | *
118 |      *   <dependenciesToAnalyzeExcludes>
119 |      *     <exclude>org.foo.*:*</exclude>
120 |      *     <exclude>com.foo.bar:*</exclude>
121 |      *     <exclude>dot.foo.bar:utilities</exclude>
122 |      *   </dependenciesToAnalyzeExcludes>
123 |      * 
124 | */ 125 | @Parameter 126 | private List dependenciesToAnalyzeExcludes; 127 | 128 | /** 129 | * Destination directory for DOT file output 130 | */ 131 | @Parameter(property = "jdeps.dotOutput") 132 | private File dotOutput; 133 | 134 | /** 135 | *
136 | *
package
Print package-level dependencies excluding dependencies within the same archive
137 | *
class
Print class-level dependencies excluding dependencies within the same archive
138 | *
<empty>
Print all class level dependencies. Equivalent to -verbose:class -filter:none.
139 | *
140 | */ 141 | @Parameter(property = "jdeps.verbose") 142 | private String verbose; 143 | 144 | /** 145 | * Finds dependences matching the specified package name. 146 | * 147 | * @since 3.1.1. 148 | */ 149 | @Parameter 150 | private List packages; 151 | 152 | /** 153 | * Restrict analysis to classes matching pattern. This option filters the list of classes to be analyzed. It can be 154 | * used together with -p and -e which apply pattern to the dependences 155 | */ 156 | @Parameter(property = "jdeps.include") 157 | private String include; 158 | 159 | /** 160 | * Restrict analysis to APIs i.e. dependences from the signature of public and protected members of public classes 161 | * including field type, method parameter types, returned type, checked exception types etc 162 | */ 163 | @Parameter(defaultValue = "false", property = "jdeps.apionly") 164 | private boolean apiOnly; 165 | 166 | /** 167 | * Show profile or the file containing a package 168 | */ 169 | @Parameter(defaultValue = "false", property = "jdeps.profile") 170 | private boolean profile; 171 | 172 | /** 173 | * Recursively traverse all dependencies. The {@code -R} option implies {@code -filter:none}. If {@code -p}, 174 | * {@code -e}, {@code -f} option is specified, only the matching dependences are analyzed. 175 | */ 176 | @Parameter(defaultValue = "false", property = "jdeps.recursive") 177 | private boolean recursive; 178 | 179 | /** 180 | * Specifies the root module for analysis. 181 | * 182 | * @since JDK 1.9.0 183 | */ 184 | @Parameter(property = "jdeps.module") 185 | private String module; 186 | 187 | private final ToolchainManager toolchainManager; 188 | 189 | protected AbstractJDepsMojo(ToolchainManager toolchainManager) { 190 | this.toolchainManager = toolchainManager; 191 | } 192 | 193 | protected MavenProject getProject() { 194 | return project; 195 | } 196 | 197 | public void execute() throws MojoExecutionException, MojoFailureException { 198 | if (!new File(getClassesDirectory()).exists()) { 199 | getLog().debug("No classes to analyze"); 200 | return; 201 | } 202 | 203 | String jExecutable; 204 | try { 205 | jExecutable = getJDepsExecutable(); 206 | } catch (IOException e) { 207 | throw new MojoFailureException("Unable to find jdeps command: " + e.getMessage(), e); 208 | } 209 | 210 | // Synopsis 211 | // jdeps [options] classes ... 212 | Commandline cmd = new Commandline(); 213 | cmd.setExecutable(jExecutable); 214 | 215 | Set dependenciesToAnalyze = null; 216 | try { 217 | dependenciesToAnalyze = getDependenciesToAnalyze(includeClasspath); 218 | } catch (DependencyResolutionRequiredException e) { 219 | throw new MojoExecutionException(e.getMessage(), e); 220 | } 221 | addJDepsOptions(cmd, dependenciesToAnalyze); 222 | addJDepsClasses(cmd, dependenciesToAnalyze); 223 | 224 | JDepsConsumer consumer = new JDepsConsumer(); 225 | executeJDepsCommandLine(cmd, outputDirectory, consumer); 226 | 227 | // @ TODO if there will be more goals, this should be pushed down to AbstractJDKInternals 228 | if (!consumer.getOffendingPackages().isEmpty()) { 229 | final String ls = System.lineSeparator(); 230 | 231 | StringBuilder msg = new StringBuilder(); 232 | msg.append("Found offending packages:").append(ls); 233 | for (Map.Entry offendingPackage : 234 | consumer.getOffendingPackages().entrySet()) { 235 | msg.append(' ') 236 | .append(offendingPackage.getKey()) 237 | .append(" -> ") 238 | .append(offendingPackage.getValue()) 239 | .append(ls); 240 | } 241 | 242 | if (isFailOnWarning()) { 243 | throw new MojoExecutionException(msg.toString()); 244 | } 245 | } 246 | } 247 | 248 | protected void addJDepsOptions(Commandline cmd, Set dependenciesToAnalyze) throws MojoFailureException { 249 | if (dotOutput != null) { 250 | cmd.createArg().setValue("-dotoutput"); 251 | cmd.createArg().setFile(dotOutput); 252 | } 253 | 254 | if (verbose != null) { 255 | if ("class".equals(verbose)) { 256 | cmd.createArg().setValue("-verbose:class"); 257 | } else if ("package".equals(verbose)) { 258 | cmd.createArg().setValue("-verbose:package"); 259 | } else { 260 | cmd.createArg().setValue("-v"); 261 | } 262 | } 263 | 264 | try { 265 | Collection cp = new ArrayList<>(); 266 | 267 | for (Path path : getClassPath()) { 268 | if (!dependenciesToAnalyze.contains(path)) { 269 | cp.add(path); 270 | } 271 | } 272 | 273 | if (!cp.isEmpty()) { 274 | cmd.createArg().setValue("-cp"); 275 | 276 | cmd.createArg().setValue(StringUtils.join(cp.iterator(), File.pathSeparator)); 277 | } 278 | 279 | } catch (DependencyResolutionRequiredException e) { 280 | throw new MojoFailureException(e.getMessage(), e); 281 | } 282 | 283 | if (packages != null) { 284 | for (String pkgName : packages) { 285 | cmd.createArg().setValue("-p"); 286 | cmd.createArg().setValue(pkgName); 287 | } 288 | } 289 | 290 | if (include != null) { 291 | cmd.createArg().setValue("-include"); 292 | cmd.createArg().setValue(include); 293 | } 294 | 295 | if (profile) { 296 | cmd.createArg().setValue("-P"); 297 | } 298 | 299 | if (module != null) { 300 | cmd.createArg().setValue("-m"); 301 | cmd.createArg().setValue(module); 302 | } 303 | 304 | if (multiRelease != null) { 305 | cmd.createArg().setValue("--multi-release"); 306 | cmd.createArg().setValue(multiRelease); 307 | } 308 | 309 | if (apiOnly) { 310 | cmd.createArg().setValue("-apionly"); 311 | } 312 | 313 | if (recursive) { 314 | cmd.createArg().setValue("-R"); 315 | } 316 | } 317 | 318 | protected Set getDependenciesToAnalyze(boolean includeClasspath) 319 | throws DependencyResolutionRequiredException { 320 | Set jdepsClasses = new LinkedHashSet<>(); 321 | 322 | jdepsClasses.add(Paths.get(getClassesDirectory())); 323 | 324 | if (includeClasspath) { 325 | jdepsClasses.addAll(getClassPath()); 326 | } 327 | 328 | if (dependenciesToAnalyzeIncludes != null) { 329 | MatchPatterns includes = MatchPatterns.from(dependenciesToAnalyzeIncludes); 330 | 331 | MatchPatterns excludes; 332 | if (dependenciesToAnalyzeExcludes != null) { 333 | excludes = MatchPatterns.from(dependenciesToAnalyzeExcludes); 334 | } else { 335 | excludes = MatchPatterns.from(Collections.emptyList()); 336 | } 337 | 338 | for (Artifact artifact : project.getArtifacts()) { 339 | String versionlessKey = ArtifactUtils.versionlessKey(artifact); 340 | 341 | if (includes.matchesPatternStart(versionlessKey, true) 342 | && !excludes.matchesPatternStart(versionlessKey, true)) { 343 | jdepsClasses.add(artifact.getFile().toPath()); 344 | } 345 | } 346 | } 347 | 348 | return jdepsClasses; 349 | } 350 | 351 | protected void addJDepsClasses(Commandline cmd, Set dependenciesToAnalyze) { 352 | // can be a pathname to a .class file, a directory, a JAR file, or a fully-qualified class name. 353 | for (Path dependencyToAnalyze : dependenciesToAnalyze) { 354 | cmd.createArg().setFile(dependencyToAnalyze.toFile()); 355 | } 356 | } 357 | 358 | private String getJDepsExecutable() throws IOException { 359 | Toolchain tc = getToolchain(); 360 | 361 | String jdepsExecutable = null; 362 | if (tc != null) { 363 | jdepsExecutable = tc.findTool("jdeps"); 364 | } 365 | 366 | String jdepsCommand = "jdeps" + (SystemUtils.IS_OS_WINDOWS ? ".exe" : ""); 367 | 368 | File jdepsExe; 369 | 370 | if (StringUtils.isNotEmpty(jdepsExecutable)) { 371 | jdepsExe = new File(jdepsExecutable); 372 | 373 | if (jdepsExe.isDirectory()) { 374 | jdepsExe = new File(jdepsExe, jdepsCommand); 375 | } 376 | 377 | if (SystemUtils.IS_OS_WINDOWS && jdepsExe.getName().indexOf('.') < 0) { 378 | jdepsExe = new File(jdepsExe.getPath() + ".exe"); 379 | } 380 | 381 | if (!jdepsExe.isFile()) { 382 | throw new IOException("The jdeps executable '" + jdepsExe + "' doesn't exist or is not a file."); 383 | } 384 | return jdepsExe.getAbsolutePath(); 385 | } 386 | 387 | jdepsExe = new File(SystemUtils.getJavaHome() + File.separator + ".." + File.separator + "sh", jdepsCommand); 388 | 389 | // ---------------------------------------------------------------------- 390 | // Try to find jdepsExe from JAVA_HOME environment variable 391 | // ---------------------------------------------------------------------- 392 | if (!jdepsExe.exists() || !jdepsExe.isFile()) { 393 | Properties env = CommandLineUtils.getSystemEnvVars(); 394 | String javaHome = env.getProperty("JAVA_HOME"); 395 | if (StringUtils.isEmpty(javaHome)) { 396 | throw new IOException("The environment variable JAVA_HOME is not correctly set."); 397 | } 398 | if ((!new File(javaHome).getCanonicalFile().exists()) 399 | || (new File(javaHome).getCanonicalFile().isFile())) { 400 | throw new IOException("The environment variable JAVA_HOME=" + javaHome 401 | + " doesn't exist or is not a valid directory."); 402 | } 403 | 404 | jdepsExe = new File(javaHome + File.separator + "bin", jdepsCommand); 405 | } 406 | 407 | if (!jdepsExe.getCanonicalFile().exists() 408 | || !jdepsExe.getCanonicalFile().isFile()) { 409 | throw new IOException("The jdeps executable '" + jdepsExe 410 | + "' doesn't exist or is not a file. Verify the JAVA_HOME environment variable."); 411 | } 412 | 413 | return jdepsExe.getAbsolutePath(); 414 | } 415 | 416 | private void executeJDepsCommandLine( 417 | Commandline cmd, File jOutputDirectory, CommandLineUtils.StringStreamConsumer consumer) 418 | throws MojoExecutionException { 419 | if (getLog().isDebugEnabled()) { 420 | // no quoted arguments 421 | getLog().debug("Executing: " 422 | + CommandLineUtils.toString(cmd.getCommandline()).replaceAll("'", "")); 423 | } 424 | 425 | CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer() { 426 | @Override 427 | public void consumeLine(String line) { 428 | if (!line.startsWith("Picked up JAVA_TOOL_OPTIONS:")) { 429 | super.consumeLine(line); 430 | } 431 | } 432 | }; 433 | CommandLineUtils.StringStreamConsumer out; 434 | if (consumer != null) { 435 | out = consumer; 436 | } else { 437 | out = new CommandLineUtils.StringStreamConsumer(); 438 | } 439 | 440 | try { 441 | int exitCode = CommandLineUtils.executeCommandLine(cmd, out, err); 442 | 443 | String output = (StringUtils.isEmpty(out.getOutput()) 444 | ? null 445 | : '\n' + out.getOutput().trim()); 446 | 447 | if (exitCode != 0) { 448 | if (StringUtils.isNotEmpty(output)) { 449 | getLog().info(output); 450 | } 451 | 452 | StringBuilder msg = new StringBuilder("\nExit code: "); 453 | msg.append(exitCode); 454 | if (StringUtils.isNotEmpty(err.getOutput())) { 455 | msg.append(" - ").append(err.getOutput()); 456 | } 457 | msg.append('\n'); 458 | msg.append("Command line was: ").append(cmd).append('\n').append('\n'); 459 | 460 | throw new MojoExecutionException(msg.toString()); 461 | } 462 | 463 | if (StringUtils.isNotEmpty(output)) { 464 | getLog().info(output); 465 | } 466 | } catch (CommandLineException e) { 467 | throw new MojoExecutionException("Unable to execute jdeps command: " + e.getMessage(), e); 468 | } 469 | 470 | // ---------------------------------------------------------------------- 471 | // Handle JDeps warnings 472 | // ---------------------------------------------------------------------- 473 | 474 | if (StringUtils.isNotEmpty(err.getOutput()) && getLog().isWarnEnabled()) { 475 | getLog().warn("JDeps Warnings"); 476 | 477 | StringTokenizer token = new StringTokenizer(err.getOutput(), "\n"); 478 | while (token.hasMoreTokens()) { 479 | String current = token.nextToken().trim(); 480 | 481 | getLog().warn(current); 482 | } 483 | } 484 | } 485 | 486 | private Toolchain getToolchain() { 487 | Toolchain tc = null; 488 | if (toolchainManager != null) { 489 | tc = toolchainManager.getToolchainFromBuildContext("jdk", session); 490 | 491 | if (tc == null) { 492 | // Maven 3.2.6 has plugin execution scoped Toolchain Support 493 | try { 494 | Method getToolchainsMethod = toolchainManager 495 | .getClass() 496 | .getMethod("getToolchains", MavenSession.class, String.class, Map.class); 497 | 498 | @SuppressWarnings("unchecked") 499 | List tcs = (List) getToolchainsMethod.invoke( 500 | toolchainManager, session, "jdk", Collections.singletonMap("version", "[1.8,)")); 501 | 502 | if (tcs != null && !tcs.isEmpty()) { 503 | // pick up latest, jdeps of JDK9 has more options compared to JDK8 504 | tc = tcs.get(tcs.size() - 1); 505 | } 506 | } catch (NoSuchMethodException 507 | | SecurityException 508 | | IllegalAccessException 509 | | IllegalArgumentException 510 | | InvocationTargetException e) { 511 | // ignore 512 | } 513 | } 514 | } 515 | 516 | return tc; 517 | } 518 | 519 | protected boolean isFailOnWarning() { 520 | return failOnWarning; 521 | } 522 | 523 | protected abstract String getClassesDirectory(); 524 | 525 | protected abstract Collection getClassPath() throws DependencyResolutionRequiredException; 526 | } 527 | -------------------------------------------------------------------------------- /src/main/java/org/apache/maven/plugins/jdeps/JDKInternalsMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | package org.apache.maven.plugins.jdeps; 20 | 21 | import javax.inject.Inject; 22 | 23 | import java.nio.file.Path; 24 | import java.nio.file.Paths; 25 | import java.util.Collection; 26 | import java.util.LinkedHashSet; 27 | import java.util.Set; 28 | 29 | import org.apache.maven.artifact.DependencyResolutionRequiredException; 30 | import org.apache.maven.plugins.annotations.LifecyclePhase; 31 | import org.apache.maven.plugins.annotations.Mojo; 32 | import org.apache.maven.plugins.annotations.ResolutionScope; 33 | import org.apache.maven.toolchain.ToolchainManager; 34 | 35 | /** 36 | * Check if main classes depend on internal JDK classes 37 | * 38 | * @author Robert Scholte 39 | * 40 | */ 41 | @Mojo( 42 | name = "jdkinternals", 43 | requiresDependencyResolution = ResolutionScope.COMPILE, 44 | defaultPhase = LifecyclePhase.PROCESS_CLASSES, 45 | threadSafe = true) 46 | public class JDKInternalsMojo extends AbstractJDepsMojo { 47 | 48 | @Inject 49 | public JDKInternalsMojo(ToolchainManager toolchainManager) { 50 | super(toolchainManager); 51 | } 52 | 53 | @Override 54 | protected String getClassesDirectory() { 55 | return getProject().getBuild().getOutputDirectory(); 56 | } 57 | 58 | @Override 59 | protected Collection getClassPath() throws DependencyResolutionRequiredException { 60 | Set classPath = 61 | new LinkedHashSet<>(getProject().getCompileClasspathElements().size()); 62 | 63 | for (String elm : getProject().getCompileClasspathElements()) { 64 | classPath.add(Paths.get(elm)); 65 | } 66 | 67 | return classPath; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/org/apache/maven/plugins/jdeps/TestJDKInternalsMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | package org.apache.maven.plugins.jdeps; 20 | 21 | import javax.inject.Inject; 22 | 23 | import java.nio.file.Path; 24 | import java.nio.file.Paths; 25 | import java.util.Collection; 26 | import java.util.LinkedHashSet; 27 | import java.util.Set; 28 | 29 | import org.apache.maven.artifact.DependencyResolutionRequiredException; 30 | import org.apache.maven.plugins.annotations.LifecyclePhase; 31 | import org.apache.maven.plugins.annotations.Mojo; 32 | import org.apache.maven.plugins.annotations.Parameter; 33 | import org.apache.maven.plugins.annotations.ResolutionScope; 34 | import org.apache.maven.toolchain.ToolchainManager; 35 | 36 | /** 37 | * Check if test classes depend on internal JDK classes 38 | * 39 | * @author Robert Scholte 40 | * 41 | */ 42 | @Mojo( 43 | name = "test-jdkinternals", 44 | requiresDependencyResolution = ResolutionScope.TEST, 45 | defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES, 46 | threadSafe = true) 47 | public class TestJDKInternalsMojo extends AbstractJDepsMojo { 48 | /** 49 | * Indicates whether the build will continue even if there are jdeps warnings. 50 | */ 51 | @Parameter(defaultValue = "true", property = "jdeps.test.failOnWarning") 52 | private boolean failOnWarning; 53 | 54 | @Inject 55 | public TestJDKInternalsMojo(ToolchainManager toolchainManager) { 56 | super(toolchainManager); 57 | } 58 | 59 | @Override 60 | protected boolean isFailOnWarning() { 61 | return failOnWarning; 62 | } 63 | 64 | @Override 65 | protected String getClassesDirectory() { 66 | return getProject().getBuild().getTestOutputDirectory(); 67 | } 68 | 69 | @Override 70 | protected Collection getClassPath() throws DependencyResolutionRequiredException { 71 | Set classPath = 72 | new LinkedHashSet<>(getProject().getTestClasspathElements().size()); 73 | 74 | for (String elm : getProject().getTestClasspathElements()) { 75 | classPath.add(Paths.get(elm)); 76 | } 77 | 78 | return classPath; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/org/apache/maven/plugins/jdeps/consumers/JDepsConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | package org.apache.maven.plugins.jdeps.consumers; 20 | 21 | import java.util.HashMap; 22 | import java.util.Map; 23 | import java.util.regex.Matcher; 24 | import java.util.regex.Pattern; 25 | 26 | import org.codehaus.plexus.util.cli.CommandLineUtils; 27 | import org.codehaus.plexus.util.cli.StreamConsumer; 28 | 29 | /** 30 | * Consumes the output of the jdeps tool 31 | * 32 | * @author Robert Scholte 33 | * 34 | */ 35 | public class JDepsConsumer extends CommandLineUtils.StringStreamConsumer implements StreamConsumer { 36 | 37 | /** 38 | * JDK8 Windows: JDK internal API (rt.jar) 39 | * JDK8 Linux: JDK internal API (JDK removed internal API) 40 | * JDK9: JDK internal API (java.base) 41 | */ 42 | private static final Pattern JDKINTERNALAPI = 43 | Pattern.compile(".+->\\s([a-z\\.]+)\\s+(JDK (?:removed )?internal API.*)"); 44 | 45 | /** 46 | *
47 | *
key
The offending package
48 | *
value
Offending details
49 | *
50 | */ 51 | private Map offendingPackages = new HashMap(); 52 | 53 | private static final Pattern PROFILE = Pattern.compile("\\s+->\\s([a-z\\.]+)\\s+(\\S+)"); 54 | 55 | /** 56 | *
57 | *
key
The package
58 | *
value
The profile
59 | *
60 | */ 61 | private Map profiles = new HashMap(); 62 | 63 | public void consumeLine(String line) { 64 | super.consumeLine(line); 65 | Matcher matcher; 66 | 67 | matcher = JDKINTERNALAPI.matcher(line); 68 | if (matcher.matches()) { 69 | offendingPackages.put(matcher.group(1), matcher.group(2)); 70 | return; 71 | } 72 | 73 | matcher = PROFILE.matcher(line); 74 | if (matcher.matches()) { 75 | profiles.put(matcher.group(1), matcher.group(2)); 76 | return; 77 | } 78 | } 79 | 80 | public Map getOffendingPackages() { 81 | return offendingPackages; 82 | } 83 | 84 | public Map getProfiles() { 85 | return profiles; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/site/apt/index.apt.vm: -------------------------------------------------------------------------------- 1 | ------ 2 | Introduction 3 | ------ 4 | Robert Scholte 5 | ------ 6 | 2015-02-05 7 | ------ 8 | 9 | ~~ Licensed to the Apache Software Foundation (ASF) under one 10 | ~~ or more contributor license agreements. See the NOTICE file 11 | ~~ distributed with this work for additional information 12 | ~~ regarding copyright ownership. The ASF licenses this file 13 | ~~ to you under the Apache License, Version 2.0 (the 14 | ~~ "License"); you may not use this file except in compliance 15 | ~~ with the License. You may obtain a copy of the License at 16 | ~~ 17 | ~~ http://www.apache.org/licenses/LICENSE-2.0 18 | ~~ 19 | ~~ Unless required by applicable law or agreed to in writing, 20 | ~~ software distributed under the License is distributed on an 21 | ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 22 | ~~ KIND, either express or implied. See the License for the 23 | ~~ specific language governing permissions and limitations 24 | ~~ under the License. 25 | 26 | ~~ NOTE: For help with the syntax of this file, see: 27 | ~~ http://maven.apache.org/doxia/references/apt-format.html 28 | 29 | ${project.name} 30 | 31 | The JDeps Plugin uses the jdeps tool to analyze classes for internal API calls. 32 | For more information about the standard jdeps tool, please refer to 33 | {{{https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool}Java+Dependency+Analysis+Tool}}. 34 | 35 | <> The jdeps tool is available since JDK8. 36 | 37 | <> The plugin has {{{http://maven.apache.org/guides/mini/guide-using-toolchains.html}toolchains support}}. 38 | When using Apache Maven 3.2.6, the build doesn't need to use toolchains itself, ie. use the <<>>; 39 | the <<>> can pick up a <<>> toolchain defined in <<>> independently from build 40 | configuration: it chooses a <<>> toolchain from available configurations that have a version <<<1.8>>> or above. 41 | 42 | * Goals Overview 43 | 44 | The JDeps Plugin has 2 goals: 45 | 46 | * {{{./jdkinternals-mojo.html}jdeps:jdkinternals}} checks if main classes depend on internal JDK classes. 47 | 48 | * {{{./test-jdkinternals-mojo.html}jdeps:test-jdkinternals}} checks if test classes depend on internal JDK classes. 49 | 50 | [] 51 | 52 | * Usage 53 | 54 | General instructions on how to use the JDeps Plugin can be found on the {{{./usage.html}usage page}}. Some more 55 | specific use cases are described in the examples given below. Last but not least, users occasionally contribute 56 | additional examples, tips or errata to the 57 | {{{http://docs.codehaus.org/display/MAVENUSER/JDeps+Plugin}plugin's wiki page}}. 58 | 59 | In case you still have questions regarding the plugin's usage, please have a look at the {{{./faq.html}FAQ}} and feel 60 | free to contact the {{{./mailing-lists.html}user mailing list}}. The posts to the mailing list are archived and could 61 | already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching 62 | the {{{./mailing-lists.html}mail archive}}. 63 | 64 | If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our 65 | {{{./issue-management.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your 66 | concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, 67 | entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. 68 | Of course, patches are welcome, too. Contributors can check out the project from our 69 | {{{./scm.html}source repository}} and will find supplementary information in the 70 | {{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}. 71 | -------------------------------------------------------------------------------- /src/site/apt/usage.apt.vm: -------------------------------------------------------------------------------- 1 | ------ 2 | Usage 3 | ------ 4 | Robert Scholte 5 | ------ 6 | 2015-02-05 7 | ------ 8 | 9 | ~~ Licensed to the Apache Software Foundation (ASF) under one 10 | ~~ or more contributor license agreements. See the NOTICE file 11 | ~~ distributed with this work for additional information 12 | ~~ regarding copyright ownership. The ASF licenses this file 13 | ~~ to you under the Apache License, Version 2.0 (the 14 | ~~ "License"); you may not use this file except in compliance 15 | ~~ with the License. You may obtain a copy of the License at 16 | ~~ 17 | ~~ http://www.apache.org/licenses/LICENSE-2.0 18 | ~~ 19 | ~~ Unless required by applicable law or agreed to in writing, 20 | ~~ software distributed under the License is distributed on an 21 | ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 22 | ~~ KIND, either express or implied. See the License for the 23 | ~~ specific language governing permissions and limitations 24 | ~~ under the License. 25 | 26 | ~~ NOTE: For help with the syntax of this file, see: 27 | ~~ http://maven.apache.org/doxia/references/apt-format.html 28 | 29 | 30 | Usage 31 | 32 | The JDeps Plugin verifies classes using the jdeps tool. The following examples describe the basic usage of the 33 | Plugin. 34 | 35 | * Verify Classes As Part Of The Build 36 | 37 | To verify the classes as part of build, you should add the JDeps Plugin in the \ section of your pom: 38 | 39 | +-----+ 40 | 41 | ... 42 | 43 | 44 | 45 | org.apache.maven.plugins 46 | ${project.artifactId} 47 | ${project.version} 48 | 49 | 50 | 51 | jdkinternals 52 | test-jdkinternals 53 | 54 | 55 | 56 | 57 | ... 58 | 59 | 60 | 61 | ... 62 | 63 | ... 64 | 65 | +-----+ 66 | 67 | If there is any usage detected of an internal API, the build will stop and fail. 68 | -------------------------------------------------------------------------------- /src/site/resources/download.cgi: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | # Just call the standard mirrors.cgi script. It will use download.html 21 | # as the input template. 22 | exec /www/www.apache.org/dyn/mirrors/mirrors.cgi $* -------------------------------------------------------------------------------- /src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/site/xdoc/download.xml.vm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | Download ${project.name} Source 25 | 26 | 27 |
28 | 29 |

${project.name} ${project.version} is distributed in source format. Use a source archive if you intend to build 30 | ${project.name} yourself. Otherwise, simply use the ready-made binary artifacts from central repository.

31 | 32 |

You will be prompted for a mirror - if the file is not found on yours, please be patient, as it may take 24 33 | hours to reach all mirrors.

34 | 35 |

In order to guard against corrupted downloads/installations, it is highly recommended to 36 | verify the signature 37 | of the release bundles against the public KEYS used by the Apache Maven 38 | developers.

39 | 40 |

${project.name} is distributed under the Apache License, version 2.0.

41 | 42 |

We strongly encourage our users to configure a Maven repository mirror closer to their location, please read How to Use Mirrors for Repositories.

43 | 44 | 45 | 46 | 47 |

48 | [if-any logo] 49 | 50 | logo 52 | 53 | [end] 54 | The currently selected mirror is 55 | [preferred]. 56 | If you encounter a problem with this mirror, 57 | please select another mirror. 58 | If all mirrors are failing, there are 59 | backup 60 | mirrors 61 | (at the end of the mirrors list) that should be available. 62 |

63 | 64 |
65 | Other mirrors: 66 | 83 | 84 |
85 | 86 |

87 | You may also consult the 88 | complete list of 89 | mirrors. 90 |

91 | 92 | 93 | 94 | 95 | 96 |

This is the current stable version of ${project.name}.

97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 |
LinkChecksumSignature
${project.name} ${project.version} (Source zip)maven/plugins/${project.artifactId}-${project.version}-source-release.zipmaven/plugins/${project.artifactId}-${project.version}-source-release.zip.sha512maven/plugins/${project.artifactId}-${project.version}-source-release.zip.asc
116 |
117 | 118 | 119 | 120 |

Older non-recommended releases can be found on our archive site.

121 | 122 |
123 |
124 | 125 |
126 | 127 | -------------------------------------------------------------------------------- /src/test/java/org/apache/maven/plugins/jdeps/consumers/JDepsConsumerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | package org.apache.maven.plugins.jdeps.consumers; 20 | 21 | import org.junit.jupiter.api.Test; 22 | 23 | import static org.junit.jupiter.api.Assertions.assertEquals; 24 | 25 | public class JDepsConsumerTest { 26 | 27 | private JDepsConsumer consumer; 28 | 29 | @Test 30 | public void testJDKInterAPI() { 31 | 32 | consumer = new JDepsConsumer(); 33 | consumer.consumeLine("test-classes -> java.base"); 34 | consumer.consumeLine(" (test-classes)"); 35 | consumer.consumeLine(" -> java.io "); 36 | consumer.consumeLine(" -> java.lang "); 37 | consumer.consumeLine( 38 | " -> sun.misc JDK internal API (java.base)"); 39 | 40 | assertEquals(1, consumer.getOffendingPackages().size()); 41 | assertEquals( 42 | "JDK internal API (java.base)", consumer.getOffendingPackages().get("sun.misc")); 43 | assertEquals(0, consumer.getProfiles().size()); 44 | } 45 | 46 | @Test 47 | public void testJDKInternalAPI_Linux_Java8() { 48 | consumer = new JDepsConsumer(); 49 | consumer.consumeLine("classes -> JDK removed internal API"); 50 | consumer.consumeLine("classes -> java.base"); 51 | consumer.consumeLine( 52 | " -> java.io java.base"); 53 | consumer.consumeLine( 54 | " -> java.lang java.base"); 55 | consumer.consumeLine( 56 | " -> sun.misc JDK internal API (JDK removed internal API)"); 57 | 58 | assertEquals(1, consumer.getOffendingPackages().size()); 59 | assertEquals( 60 | "JDK internal API (JDK removed internal API)", 61 | consumer.getOffendingPackages().get("sun.misc")); 62 | assertEquals(0, consumer.getProfiles().size()); 63 | } 64 | 65 | @Test 66 | public void testJDKInternalAPI_Java8_291() { 67 | consumer = new JDepsConsumer(); 68 | consumer.consumeLine("classes -> JDK removed internal API"); 69 | consumer.consumeLine("classes -> java.base"); 70 | consumer.consumeLine( 71 | " -> java.io java.base"); 72 | consumer.consumeLine( 73 | " -> java.lang java.base"); 74 | consumer.consumeLine( 75 | " -> sun.misc JDK removed internal API"); 76 | 77 | assertEquals(1, consumer.getOffendingPackages().size()); 78 | assertEquals("JDK removed internal API", consumer.getOffendingPackages().get("sun.misc")); 79 | assertEquals(0, consumer.getProfiles().size()); 80 | } 81 | 82 | @Test 83 | public void testProfile() { 84 | consumer = new JDepsConsumer(); 85 | consumer.consumeLine("E:\\java-workspace\\apache-maven-plugins\\maven-jdeps-plugin\\target\\classes -> " 86 | + "C:\\Program Files\\Java\\jdk1.8.0\\jre\\lib\\rt.jar (compact1)"); 87 | consumer.consumeLine(" (classes)"); 88 | consumer.consumeLine(" -> java.io compact1"); 89 | consumer.consumeLine(" -> java.lang compact1"); 90 | consumer.consumeLine(" -> sun.misc JDK internal API (rt.jar)"); 91 | 92 | assertEquals(1, consumer.getOffendingPackages().size()); 93 | assertEquals( 94 | "JDK internal API (rt.jar)", consumer.getOffendingPackages().get("sun.misc")); 95 | assertEquals(2, consumer.getProfiles().size()); 96 | assertEquals("compact1", consumer.getProfiles().get("java.io")); 97 | assertEquals("compact1", consumer.getProfiles().get("java.lang")); 98 | } 99 | } 100 | --------------------------------------------------------------------------------