├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── .travis.yml ├── .travis └── settings.xml ├── LICENSE.txt ├── README.md ├── build ├── build.config ├── header.txt ├── mvnsh-assembly ├── pom.xml └── src │ └── main │ ├── assembly │ └── bin.xml │ └── resources │ ├── LICENSE.txt │ ├── README.txt │ ├── bin │ ├── mvnsh │ ├── mvnsh.bat │ ├── mvnx │ └── mvnx.bat │ ├── etc │ ├── logback.xml │ └── mvnsh.profile │ └── examples │ └── mvnsh.rc ├── mvnsh-bootstrap ├── pom.xml └── src │ └── main │ └── filtered-resources │ └── bootstrap.properties ├── mvnsh-commands ├── pom.xml └── src │ ├── main │ ├── java │ │ ├── com │ │ │ └── planet57 │ │ │ │ └── maven │ │ │ │ └── shell │ │ │ │ └── commands │ │ │ │ └── maven │ │ │ │ ├── EncryptPasswordAction.java │ │ │ │ ├── MavenAction.java │ │ │ │ ├── MavenCompleter.java │ │ │ │ ├── MavenModule.java │ │ │ │ ├── MavenOptionCompleter.java │ │ │ │ ├── MavenPhaseCompleter.java │ │ │ │ ├── MavenPluginGoalCompleter.java │ │ │ │ └── package-info.java │ │ └── org │ │ │ └── apache │ │ │ └── maven │ │ │ └── cli │ │ │ └── CliRequestBuilder.java │ └── resources │ │ └── com │ │ └── planet57 │ │ └── maven │ │ └── shell │ │ └── commands │ │ └── maven │ │ ├── EncryptPasswordAction.help │ │ └── MavenAction.help │ └── test │ ├── java │ └── com │ │ └── planet57 │ │ └── maven │ │ └── shell │ │ └── commands │ │ └── maven │ │ ├── EncryptPasswordActionTest.groovy │ │ └── MavenActionTest.groovy │ └── resources │ └── com │ └── planet57 │ └── maven │ └── shell │ └── commands │ └── maven │ ├── settings.xml │ └── test1.pom ├── mvnsh-personality ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── planet57 │ │ └── maven │ │ └── shell │ │ ├── BrandingImpl.java │ │ ├── Main.java │ │ └── package-info.java │ └── resources │ └── com │ └── planet57 │ └── maven │ └── shell │ └── license.txt ├── mvnw ├── mvnw.cmd ├── pom.xml └── src └── art ├── logo-48x48.png ├── logo.png ├── logo.psd └── shell1.psd /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | *.ipr 4 | .classpath 5 | .project 6 | .settings 7 | target 8 | build.rc 9 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdillon/mvnsh/06a25d4240a87c6f6e972db3239d56125ddb95b0/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | sudo: false 4 | 5 | env: 6 | global: 7 | - secure: 'I4Ju1i2D+EZgLUYBlnf2tWxJS8ds1HQGxBoum8XpNxMrp9QQ3Aq7EnHiVRfpAa5JsKvsPLd4jdQlponAy15GwZdYDHAXy2lPintIdSFkp/Xnrn/bi0qeNqSWFg71w7ELcXXP6VE4VJYsSZewRNPlyjfTIcYVykq27hOQCZqzKg8=' 8 | - MAVEN_SETTINGS='.travis/settings.xml' 9 | - MAVEN_OPTIONS="-V -B -s $MAVEN_SETTINGS" 10 | 11 | branches: 12 | only: 13 | - master 14 | 15 | jdk: 16 | - oraclejdk8 17 | 18 | install: ./build ci-prepare $MAVEN_OPTIONS 19 | 20 | script: ./build ci-build $MAVEN_OPTIONS 21 | -------------------------------------------------------------------------------- /.travis/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ossrh 6 | jdillon 7 | ${env.SONATYPE_PASSWORD} 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-present the original author or authors. 2 | 3 | -------------------------------------------------------------------------- 4 | 5 | Eclipse Public License - v 1.0 6 | 7 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE 8 | PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF 9 | THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 10 | 11 | 1. DEFINITIONS 12 | 13 | "Contribution" means: 14 | 15 | a) in the case of the initial Contributor, the initial code and 16 | documentation distributed under this Agreement, and 17 | b) in the case of each subsequent Contributor: 18 | 19 | i) changes to the Program, and 20 | 21 | ii) additions to the Program; 22 | 23 | where such changes and/or additions to the Program originate from and 24 | are distributed by that particular Contributor. A Contribution 25 | 'originates' from a Contributor if it was added to the Program by such 26 | Contributor itself or anyone acting on such Contributor's behalf. 27 | Contributions do not include additions to the Program which: (i) are 28 | separate modules of software distributed in conjunction with the 29 | Program under their own license agreement, and (ii) are not derivative 30 | works of the Program. 31 | 32 | "Contributor" means any person or entity that distributes the Program. 33 | 34 | "Licensed Patents " mean patent claims licensable by a Contributor 35 | which are necessarily infringed by the use or sale of its Contribution 36 | alone or when combined with the Program. 37 | 38 | "Program" means the Contributions distributed in accordance with this 39 | Agreement. 40 | 41 | "Recipient" means anyone who receives the Program under this 42 | Agreement, including all Contributors. 43 | 44 | 2. GRANT OF RIGHTS 45 | 46 | a) Subject to the terms of this Agreement, each Contributor hereby 47 | grants Recipient a non-exclusive, worldwide, royalty-free copyright 48 | license to reproduce, prepare derivative works of, publicly display, 49 | publicly perform, distribute and sublicense the Contribution of such 50 | Contributor, if any, and such derivative works, in source code and 51 | object code form. 52 | 53 | b) Subject to the terms of this Agreement, each Contributor hereby 54 | grants Recipient a non-exclusive, worldwide, royalty-free patent 55 | license under Licensed Patents to make, use, sell, offer to sell, 56 | import and otherwise transfer the Contribution of such Contributor, if 57 | any, in source code and object code form. This patent license shall 58 | apply to the combination of the Contribution and the Program if, at 59 | the time the Contribution is added by the Contributor, such addition 60 | of the Contribution causes such combination to be covered by the 61 | Licensed Patents. The patent license shall not apply to any other 62 | combinations which include the Contribution. No hardware per se is 63 | licensed hereunder. 64 | 65 | c) Recipient understands that although each Contributor grants the 66 | licenses to its Contributions set forth herein, no assurances are 67 | provided by any Contributor that the Program does not infringe the 68 | patent or other intellectual property rights of any other entity. Each 69 | Contributor disclaims any liability to Recipient for claims brought by 70 | any other entity based on infringement of intellectual property rights 71 | or otherwise. As a condition to exercising the rights and licenses 72 | granted hereunder, each Recipient hereby assumes sole responsibility 73 | to secure any other intellectual property rights needed, if any. For 74 | example, if a third party patent license is required to allow 75 | Recipient to distribute the Program, it is Recipient's responsibility 76 | to acquire that license before distributing the Program. 77 | 78 | d) Each Contributor represents that to its knowledge it has sufficient 79 | copyright rights in its Contribution, if any, to grant the copyright 80 | license set forth in this Agreement. 81 | 82 | 3. REQUIREMENTS 83 | 84 | A Contributor may choose to distribute the Program in object code form 85 | under its own license agreement, provided that: 86 | 87 | a) it complies with the terms and conditions of this Agreement; and 88 | 89 | b) its license agreement: 90 | 91 | i) effectively disclaims on behalf of all Contributors all warranties 92 | and conditions, express and implied, including warranties or 93 | conditions of title and non-infringement, and implied warranties or 94 | conditions of merchantability and fitness for a particular purpose; 95 | 96 | ii) effectively excludes on behalf of all Contributors all liability 97 | for damages, including direct, indirect, special, incidental and 98 | consequential damages, such as lost profits; 99 | 100 | iii) states that any provisions which differ from this Agreement are 101 | offered by that Contributor alone and not by any other party; and 102 | 103 | iv) states that source code for the Program is available from such 104 | Contributor, and informs licensees how to obtain it in a reasonable 105 | manner on or through a medium customarily used for software exchange. 106 | 107 | When the Program is made available in source code form: 108 | 109 | a) it must be made available under this Agreement; and 110 | 111 | b) a copy of this Agreement must be included with each copy of the 112 | Program. 113 | 114 | Contributors may not remove or alter any copyright notices contained 115 | within the Program. 116 | 117 | Each Contributor must identify itself as the originator of its 118 | Contribution, if any, in a manner that reasonably allows subsequent 119 | Recipients to identify the originator of the Contribution. 120 | 121 | 4. COMMERCIAL DISTRIBUTION 122 | 123 | Commercial distributors of software may accept certain 124 | responsibilities with respect to end users, business partners and the 125 | like. While this license is intended to facilitate the commercial use 126 | of the Program, the Contributor who includes the Program in a 127 | commercial product offering should do so in a manner which does not 128 | create potential liability for other Contributors. Therefore, if a 129 | Contributor includes the Program in a commercial product offering, 130 | such Contributor ("Commercial Contributor") hereby agrees to defend 131 | and indemnify every other Contributor ("Indemnified Contributor") 132 | against any losses, damages and costs (collectively "Losses") arising 133 | from claims, lawsuits and other legal actions brought by a third party 134 | against the Indemnified Contributor to the extent caused by the acts 135 | or omissions of such Commercial Contributor in connection with its 136 | distribution of the Program in a commercial product offering. The 137 | obligations in this section do not apply to any claims or Losses 138 | relating to any actual or alleged intellectual property infringement. 139 | In order to qualify, an Indemnified Contributor must: a) promptly 140 | notify the Commercial Contributor in writing of such claim, and b) 141 | allow the Commercial Contributor to control, and cooperate with the 142 | Commercial Contributor in, the defense and any related settlement 143 | negotiations. The Indemnified Contributor may participate in any such 144 | claim at its own expense. 145 | 146 | For example, a Contributor might include the Program in a commercial 147 | product offering, Product X. That Contributor is then a Commercial 148 | Contributor. If that Commercial Contributor then makes performance 149 | claims, or offers warranties related to Product X, those performance 150 | claims and warranties are such Commercial Contributor's responsibility 151 | alone. Under this section, the Commercial Contributor would have to 152 | defend claims against the other Contributors related to those 153 | performance claims and warranties, and if a court requires any other 154 | Contributor to pay any damages as a result, the Commercial Contributor 155 | must pay those damages. 156 | 157 | 5. NO WARRANTY 158 | 159 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS 160 | PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 161 | KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY 162 | WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY 163 | OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely 164 | responsible for determining the appropriateness of using and 165 | distributing the Program and assumes all risks associated with its 166 | exercise of rights under this Agreement , including but not limited to 167 | the risks and costs of program errors, compliance with applicable 168 | laws, damage to or loss of data, programs or equipment, and 169 | unavailability or interruption of operations. 170 | 171 | 6. DISCLAIMER OF LIABILITY 172 | 173 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR 174 | ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, 175 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING 176 | WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF 177 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 178 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR 179 | DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 180 | HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 181 | 182 | 7. GENERAL 183 | 184 | If any provision of this Agreement is invalid or unenforceable under 185 | applicable law, it shall not affect the validity or enforceability of 186 | the remainder of the terms of this Agreement, and without further 187 | action by the parties hereto, such provision shall be reformed to the 188 | minimum extent necessary to make such provision valid and enforceable. 189 | 190 | If Recipient institutes patent litigation against any entity 191 | (including a cross-claim or counterclaim in a lawsuit) alleging that 192 | the Program itself (excluding combinations of the Program with other 193 | software or hardware) infringes such Recipient's patent(s), then such 194 | Recipient's rights granted under Section 2(b) shall terminate as of 195 | the date such litigation is filed. 196 | 197 | All Recipient's rights under this Agreement shall terminate if it 198 | fails to comply with any of the material terms or conditions of this 199 | Agreement and does not cure such failure in a reasonable period of 200 | time after becoming aware of such noncompliance. If all Recipient's 201 | rights under this Agreement terminate, Recipient agrees to cease use 202 | and distribution of the Program as soon as reasonably practicable. 203 | However, Recipient's obligations under this Agreement and any licenses 204 | granted by Recipient relating to the Program shall continue and 205 | survive. 206 | 207 | Everyone is permitted to copy and distribute copies of this Agreement, 208 | but in order to avoid inconsistency the Agreement is copyrighted and 209 | may only be modified in the following manner. The Agreement Steward 210 | reserves the right to publish new versions (including revisions) of 211 | this Agreement from time to time. No one other than the Agreement 212 | Steward has the right to modify this Agreement. The Eclipse Foundation 213 | is the initial Agreement Steward. The Eclipse Foundation may assign 214 | the responsibility to serve as the Agreement Steward to a suitable 215 | separate entity. Each new version of the Agreement will be given a 216 | distinguishing version number. The Program (including Contributions) 217 | may always be distributed subject to the version of the Agreement 218 | under which it was received. In addition, after a new version of the 219 | Agreement is published, Contributor may elect to distribute the 220 | Program (including its Contributions) under the new version. Except as 221 | expressly stated in Sections 2(a) and 2(b) above, Recipient receives 222 | no rights or licenses to the intellectual property of any Contributor 223 | under this Agreement, whether expressly, by implication, estoppel or 224 | otherwise. All rights in the Program not expressly granted under this 225 | Agreement are reserved. 226 | 227 | This Agreement is governed by the laws of the State of New York and 228 | the intellectual property laws of the United States of America. No 229 | party to this Agreement will bring a legal action under this Agreement 230 | more than one year after the cause of action arose. Each party waives 231 | its rights to a jury trial in any resulting litigation. 232 | 233 | -------------------------------------------------------------------------- 234 | 235 | Apache License 236 | Version 2.0, January 2004 237 | http://www.apache.org/licenses/ 238 | 239 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 240 | 241 | 1. Definitions. 242 | 243 | "License" shall mean the terms and conditions for use, reproduction, 244 | and distribution as defined by Sections 1 through 9 of this document. 245 | 246 | "Licensor" shall mean the copyright owner or entity authorized by 247 | the copyright owner that is granting the License. 248 | 249 | "Legal Entity" shall mean the union of the acting entity and all 250 | other entities that control, are controlled by, or are under common 251 | control with that entity. For the purposes of this definition, 252 | "control" means (i) the power, direct or indirect, to cause the 253 | direction or management of such entity, whether by contract or 254 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 255 | outstanding shares, or (iii) beneficial ownership of such entity. 256 | 257 | "You" (or "Your") shall mean an individual or Legal Entity 258 | exercising permissions granted by this License. 259 | 260 | "Source" form shall mean the preferred form for making modifications, 261 | including but not limited to software source code, documentation 262 | source, and configuration files. 263 | 264 | "Object" form shall mean any form resulting from mechanical 265 | transformation or translation of a Source form, including but 266 | not limited to compiled object code, generated documentation, 267 | and conversions to other media types. 268 | 269 | "Work" shall mean the work of authorship, whether in Source or 270 | Object form, made available under the License, as indicated by a 271 | copyright notice that is included in or attached to the work 272 | (an example is provided in the Appendix below). 273 | 274 | "Derivative Works" shall mean any work, whether in Source or Object 275 | form, that is based on (or derived from) the Work and for which the 276 | editorial revisions, annotations, elaborations, or other modifications 277 | represent, as a whole, an original work of authorship. For the purposes 278 | of this License, Derivative Works shall not include works that remain 279 | separable from, or merely link (or bind by name) to the interfaces of, 280 | the Work and Derivative Works thereof. 281 | 282 | "Contribution" shall mean any work of authorship, including 283 | the original version of the Work and any modifications or additions 284 | to that Work or Derivative Works thereof, that is intentionally 285 | submitted to Licensor for inclusion in the Work by the copyright owner 286 | or by an individual or Legal Entity authorized to submit on behalf of 287 | the copyright owner. For the purposes of this definition, "submitted" 288 | means any form of electronic, verbal, or written communication sent 289 | to the Licensor or its representatives, including but not limited to 290 | communication on electronic mailing lists, source code control systems, 291 | and issue tracking systems that are managed by, or on behalf of, the 292 | Licensor for the purpose of discussing and improving the Work, but 293 | excluding communication that is conspicuously marked or otherwise 294 | designated in writing by the copyright owner as "Not a Contribution." 295 | 296 | "Contributor" shall mean Licensor and any individual or Legal Entity 297 | on behalf of whom a Contribution has been received by Licensor and 298 | subsequently incorporated within the Work. 299 | 300 | 2. Grant of Copyright License. Subject to the terms and conditions of 301 | this License, each Contributor hereby grants to You a perpetual, 302 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 303 | copyright license to reproduce, prepare Derivative Works of, 304 | publicly display, publicly perform, sublicense, and distribute the 305 | Work and such Derivative Works in Source or Object form. 306 | 307 | 3. Grant of Patent License. Subject to the terms and conditions of 308 | this License, each Contributor hereby grants to You a perpetual, 309 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 310 | (except as stated in this section) patent license to make, have made, 311 | use, offer to sell, sell, import, and otherwise transfer the Work, 312 | where such license applies only to those patent claims licensable 313 | by such Contributor that are necessarily infringed by their 314 | Contribution(s) alone or by combination of their Contribution(s) 315 | with the Work to which such Contribution(s) was submitted. If You 316 | institute patent litigation against any entity (including a 317 | cross-claim or counterclaim in a lawsuit) alleging that the Work 318 | or a Contribution incorporated within the Work constitutes direct 319 | or contributory patent infringement, then any patent licenses 320 | granted to You under this License for that Work shall terminate 321 | as of the date such litigation is filed. 322 | 323 | 4. Redistribution. You may reproduce and distribute copies of the 324 | Work or Derivative Works thereof in any medium, with or without 325 | modifications, and in Source or Object form, provided that You 326 | meet the following conditions: 327 | 328 | (a) You must give any other recipients of the Work or 329 | Derivative Works a copy of this License; and 330 | 331 | (b) You must cause any modified files to carry prominent notices 332 | stating that You changed the files; and 333 | 334 | (c) You must retain, in the Source form of any Derivative Works 335 | that You distribute, all copyright, patent, trademark, and 336 | attribution notices from the Source form of the Work, 337 | excluding those notices that do not pertain to any part of 338 | the Derivative Works; and 339 | 340 | (d) If the Work includes a "NOTICE" text file as part of its 341 | distribution, then any Derivative Works that You distribute must 342 | include a readable copy of the attribution notices contained 343 | within such NOTICE file, excluding those notices that do not 344 | pertain to any part of the Derivative Works, in at least one 345 | of the following places: within a NOTICE text file distributed 346 | as part of the Derivative Works; within the Source form or 347 | documentation, if provided along with the Derivative Works; or, 348 | within a display generated by the Derivative Works, if and 349 | wherever such third-party notices normally appear. The contents 350 | of the NOTICE file are for informational purposes only and 351 | do not modify the License. You may add Your own attribution 352 | notices within Derivative Works that You distribute, alongside 353 | or as an addendum to the NOTICE text from the Work, provided 354 | that such additional attribution notices cannot be construed 355 | as modifying the License. 356 | 357 | You may add Your own copyright statement to Your modifications and 358 | may provide additional or different license terms and conditions 359 | for use, reproduction, or distribution of Your modifications, or 360 | for any such Derivative Works as a whole, provided Your use, 361 | reproduction, and distribution of the Work otherwise complies with 362 | the conditions stated in this License. 363 | 364 | 5. Submission of Contributions. Unless You explicitly state otherwise, 365 | any Contribution intentionally submitted for inclusion in the Work 366 | by You to the Licensor shall be under the terms and conditions of 367 | this License, without any additional terms or conditions. 368 | Notwithstanding the above, nothing herein shall supersede or modify 369 | the terms of any separate license agreement you may have executed 370 | with Licensor regarding such Contributions. 371 | 372 | 6. Trademarks. This License does not grant permission to use the trade 373 | names, trademarks, service marks, or product names of the Licensor, 374 | except as required for reasonable and customary use in describing the 375 | origin of the Work and reproducing the content of the NOTICE file. 376 | 377 | 7. Disclaimer of Warranty. Unless required by applicable law or 378 | agreed to in writing, Licensor provides the Work (and each 379 | Contributor provides its Contributions) on an "AS IS" BASIS, 380 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 381 | implied, including, without limitation, any warranties or conditions 382 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 383 | PARTICULAR PURPOSE. You are solely responsible for determining the 384 | appropriateness of using or redistributing the Work and assume any 385 | risks associated with Your exercise of permissions under this License. 386 | 387 | 8. Limitation of Liability. In no event and under no legal theory, 388 | whether in tort (including negligence), contract, or otherwise, 389 | unless required by applicable law (such as deliberate and grossly 390 | negligent acts) or agreed to in writing, shall any Contributor be 391 | liable to You for damages, including any direct, indirect, special, 392 | incidental, or consequential damages of any character arising as a 393 | result of this License or out of the use or inability to use the 394 | Work (including but not limited to damages for loss of goodwill, 395 | work stoppage, computer failure or malfunction, or any and all 396 | other commercial damages or losses), even if such Contributor 397 | has been advised of the possibility of such damages. 398 | 399 | 9. Accepting Warranty or Additional Liability. While redistributing 400 | the Work or Derivative Works thereof, You may choose to offer, 401 | and charge a fee for, acceptance of support, warranty, indemnity, 402 | or other liability obligations and/or rights consistent with this 403 | License. However, in accepting such obligations, You may act only 404 | on Your own behalf and on Your sole responsibility, not on behalf 405 | of any other Contributor, and only if You agree to indemnify, 406 | defend, and hold each Contributor harmless for any liability 407 | incurred by, or claims asserted against, such Contributor by reason 408 | of your accepting any such warranty or additional liability. 409 | 410 | END OF TERMS AND CONDITIONS 411 | 412 | APPENDIX: How to apply the Apache License to your work. 413 | 414 | To apply the Apache License to your work, attach the following 415 | boilerplate notice, with the fields enclosed by brackets "[]" 416 | replaced with your own identifying information. (Don't include 417 | the brackets!) The text should be enclosed in the appropriate 418 | comment syntax for the file format. We also recommend that a 419 | file or class name and description of purpose be included on the 420 | same "printed page" as the copyright notice for easier 421 | identification within third-party archives. 422 | 423 | Copyright [yyyy] [name of copyright owner] 424 | 425 | Licensed under the Apache License, Version 2.0 (the "License"); 426 | you may not use this file except in compliance with the License. 427 | You may obtain a copy of the License at 428 | 429 | http://www.apache.org/licenses/LICENSE-2.0 430 | 431 | Unless required by applicable law or agreed to in writing, software 432 | distributed under the License is distributed on an "AS IS" BASIS, 433 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 434 | See the License for the specific language governing permissions and 435 | limitations under the License. 436 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 18 | # Description 19 | 20 | Maven Shell (`mvnsh`) 21 | 22 | [![Build Status](https://travis-ci.org/jdillon/mvnsh.svg?branch=master)](https://travis-ci.org/jdillon/mvnsh) 23 | [![DepShield Badge](https://depshield.sonatype.org/badges/jdillon/mvnsh/depshield.svg)](https://depshield.github.io) 24 | 25 | Based on [GShell 3](https://github.com/jdillon/gshell). 26 | 27 | # License 28 | 29 | [Eclipse Public License 1.0](http://www.eclipse.org/org/documents/epl-v10.html) 30 | 31 | [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) 32 | 33 | # Building 34 | 35 | ## Requirements 36 | 37 | * [Maven](http://maven.apache.org) 3.3+ (prefer included maven-wrapper) 38 | * [Java](http://java.oracle.com/) 8+ 39 | 40 | Check-out and build: 41 | 42 | git clone git://github.com/jdillon/mvnsh.git 43 | cd mvnsh 44 | ./build rebuild 45 | 46 | Extract the assembly and execute the shell: 47 | 48 | ./build run 49 | -------------------------------------------------------------------------------- /build: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | basename=`basename $0` 3 | dirname=`dirname $0` 4 | dirname=`cd "$dirname" && pwd` 5 | cd "$dirname" 6 | 7 | source build.config 8 | 9 | # load optional config 10 | if [ -f ./build.rc ]; then 11 | source ./build.rc 12 | fi 13 | 14 | # show message and exit 15 | function die { 16 | echo "$1" 17 | exit 1 18 | } 19 | 20 | # show usage and exit 21 | function usage { 22 | echo "usage: $basename [options]" 23 | exit 2 24 | } 25 | 26 | # run self 27 | function self { 28 | $0 $* 29 | } 30 | 31 | # run maven 32 | function mvn { 33 | ./mvnw $* 34 | } 35 | 36 | command="$1"; shift 37 | 38 | # complain if no command is given 39 | if [ -z "$command" ]; then 40 | usage 41 | fi 42 | 43 | case "$command" in 44 | # change the version of the project 45 | change-version) 46 | newVersion="$1" 47 | if [ -z "$newVersion" ]; then 48 | usage "$command " 49 | fi 50 | 51 | mvn org.eclipse.tycho:tycho-versions-plugin:0.25.0:set-version \ 52 | -Dtycho.mode=maven \ 53 | -Dartifacts=${project} \ 54 | -Dproperties=${project}.version \ 55 | -DnewVersion="$newVersion" 56 | ;; 57 | 58 | # check license headers 59 | license-check) 60 | mvn -Plicense-check -N $* 61 | ;; 62 | 63 | # format license headers 64 | license-format) 65 | mvn -Plicense-format -N $* 66 | ;; 67 | 68 | # prepare CI build 69 | ci-prepare) 70 | self license-check $* 71 | ;; 72 | 73 | # build for CI 74 | ci-build) 75 | if [ "$TRAVIS_PULL_REQUEST" != 'false' ]; then 76 | goal=install 77 | else 78 | goal=deploy 79 | fi 80 | mvn clean ${goal} $* 81 | ;; 82 | 83 | # release automation 84 | release) 85 | version="$1" 86 | nextVersion="$2" 87 | if [ -z "$version" -o -z "$nextVersion" ]; then 88 | usage "$command " 89 | fi 90 | releaseTag="release-$version" 91 | 92 | # update version and tag 93 | self change-version "$version" 94 | git commit -a -m "update version: $version" 95 | git tag $releaseTag 96 | 97 | # deploy release 98 | mvn -Pbuildsupport-release clean deploy 99 | 100 | # update to next version 101 | self change-version "$nextVersion" 102 | git commit -a -m "update version: $nextVersion" 103 | ;; 104 | 105 | *) 106 | # attempt to lookup command function 107 | fn="command_$command" 108 | if [ "$(type -t $fn)" = 'function' ]; then 109 | $fn $* 110 | else 111 | # complain about missing command function 112 | echo "Unknown command: $command" 113 | usage 114 | fi 115 | ;; 116 | esac 117 | -------------------------------------------------------------------------------- /build.config: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | project=mvnsh 4 | 5 | function command_rebuild { 6 | mvn clean install $* 7 | unzip -d target mvnsh-assembly/target/mvnsh-*-bin.zip 8 | } 9 | 10 | function command_rebuild_quick { 11 | self rebuild -Dtest=skip -o $* 12 | } 13 | 14 | function command_run { 15 | export JAVA_OPTS="-Dshell.logging.file.threshold=DEBUG -Dshell.logging.root-level=DEBUG $JAVA_OPTS" 16 | export MAVEN_OPTS="$JAVA_OPTS" 17 | exec target/mvnsh-*/bin/mvnsh $* 18 | } 19 | 20 | function command_debug { 21 | export JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 $JAVA_OPTS" 22 | self run $* 23 | } 24 | 25 | function command_run_trace { 26 | export JAVA_OPTS="-Dcom.planet57.gossip.Log.threshold=TRACE -Dshell.logging.file.threshold=TRACE -Dshell.logging.root-level=TRACE $JAVA_OPTS" 27 | self run $* 28 | } 29 | 30 | function command_kill { 31 | ps -ef | grep target/mvnsh-*/boot/bootstrap.jar | grep -v grep | cut -c7-12 | xargs kill 32 | } 33 | -------------------------------------------------------------------------------- /header.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-present the original author or authors. 2 | 3 | All rights reserved. This program and the accompanying materials 4 | are made available under the terms of the Eclipse Public License v1.0 5 | and Apache License v2.0 which accompanies this distribution. 6 | 7 | The Eclipse Public License is available at 8 | http://www.eclipse.org/legal/epl-v10.html 9 | 10 | The Apache License v2.0 is available at 11 | http://www.apache.org/licenses/LICENSE-2.0.html 12 | 13 | You may elect to redistribute this code under either of these licenses. 14 | -------------------------------------------------------------------------------- /mvnsh-assembly/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 21 | 22 | 4.0.0 23 | 24 | 25 | com.planet57.maven.shell 26 | mvnsh 27 | 1.2.0-SNAPSHOT 28 | 29 | 30 | mvnsh-assembly 31 | ${project.groupId}:${project.artifactId} 32 | pom 33 | 34 | 35 | 36 | com.planet57.maven.shell 37 | mvnsh-bootstrap 38 | 39 | 40 | 41 | com.planet57.maven.shell 42 | mvnsh-personality 43 | 44 | 45 | 46 | com.planet57.maven.shell 47 | mvnsh-commands 48 | 49 | 50 | 51 | org.jline 52 | jline-terminal-jansi 53 | 54 | 55 | 56 | org.jline 57 | jline-terminal-jna 58 | 59 | 60 | 61 | com.planet57.gshell.commands 62 | gshell-standard 63 | 64 | 65 | 66 | com.planet57.gshell.commands 67 | gshell-shell 68 | 69 | 70 | 71 | com.planet57.gshell.commands 72 | gshell-file 73 | 74 | 75 | 76 | com.planet57.gshell.commands 77 | gshell-logging 78 | 79 | 80 | 81 | com.planet57.gshell.commands 82 | gshell-pref 83 | 84 | 85 | 86 | 87 | mvnsh-${project.version} 88 | 89 | 90 | 91 | org.apache.maven.plugins 92 | maven-assembly-plugin 93 | 94 | 95 | package 96 | 97 | single 98 | 99 | 100 | posix 101 | 102 | src/main/assembly/bin.xml 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /mvnsh-assembly/src/main/assembly/bin.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 22 | 23 | bin 24 | 25 | 26 | zip 27 | tar.gz 28 | 29 | 30 | 31 | 32 | ${project.basedir}/src/main/resources 33 | 34 | 0644 35 | 0755 36 | 37 | bin/* 38 | 39 | 40 | 41 | 42 | ${project.basedir}/src/main/resources 43 | 44 | 0644 45 | 0755 46 | dos 47 | 48 | bin/*.bat 49 | 50 | 51 | 52 | 53 | ${project.basedir}/src/main/resources 54 | 55 | 0755 56 | 0755 57 | unix 58 | 59 | bin/* 60 | 61 | 62 | bin/*.bat 63 | 64 | 65 | 66 | 67 | 68 | 69 | boot 70 | bootstrap.jar 71 | false 72 | 73 | com.planet57.maven.shell:mvnsh-bootstrap 74 | 75 | 76 | 77 | 78 | lib 79 | true 80 | false 81 | 82 | com.planet57.maven.shell:mvnsh-bootstrap 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /mvnsh-assembly/src/main/resources/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-present the original author or authors. 2 | 3 | -------------------------------------------------------------------------- 4 | 5 | Eclipse Public License - v 1.0 6 | 7 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE 8 | PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF 9 | THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 10 | 11 | 1. DEFINITIONS 12 | 13 | "Contribution" means: 14 | 15 | a) in the case of the initial Contributor, the initial code and 16 | documentation distributed under this Agreement, and 17 | b) in the case of each subsequent Contributor: 18 | 19 | i) changes to the Program, and 20 | 21 | ii) additions to the Program; 22 | 23 | where such changes and/or additions to the Program originate from and 24 | are distributed by that particular Contributor. A Contribution 25 | 'originates' from a Contributor if it was added to the Program by such 26 | Contributor itself or anyone acting on such Contributor's behalf. 27 | Contributions do not include additions to the Program which: (i) are 28 | separate modules of software distributed in conjunction with the 29 | Program under their own license agreement, and (ii) are not derivative 30 | works of the Program. 31 | 32 | "Contributor" means any person or entity that distributes the Program. 33 | 34 | "Licensed Patents " mean patent claims licensable by a Contributor 35 | which are necessarily infringed by the use or sale of its Contribution 36 | alone or when combined with the Program. 37 | 38 | "Program" means the Contributions distributed in accordance with this 39 | Agreement. 40 | 41 | "Recipient" means anyone who receives the Program under this 42 | Agreement, including all Contributors. 43 | 44 | 2. GRANT OF RIGHTS 45 | 46 | a) Subject to the terms of this Agreement, each Contributor hereby 47 | grants Recipient a non-exclusive, worldwide, royalty-free copyright 48 | license to reproduce, prepare derivative works of, publicly display, 49 | publicly perform, distribute and sublicense the Contribution of such 50 | Contributor, if any, and such derivative works, in source code and 51 | object code form. 52 | 53 | b) Subject to the terms of this Agreement, each Contributor hereby 54 | grants Recipient a non-exclusive, worldwide, royalty-free patent 55 | license under Licensed Patents to make, use, sell, offer to sell, 56 | import and otherwise transfer the Contribution of such Contributor, if 57 | any, in source code and object code form. This patent license shall 58 | apply to the combination of the Contribution and the Program if, at 59 | the time the Contribution is added by the Contributor, such addition 60 | of the Contribution causes such combination to be covered by the 61 | Licensed Patents. The patent license shall not apply to any other 62 | combinations which include the Contribution. No hardware per se is 63 | licensed hereunder. 64 | 65 | c) Recipient understands that although each Contributor grants the 66 | licenses to its Contributions set forth herein, no assurances are 67 | provided by any Contributor that the Program does not infringe the 68 | patent or other intellectual property rights of any other entity. Each 69 | Contributor disclaims any liability to Recipient for claims brought by 70 | any other entity based on infringement of intellectual property rights 71 | or otherwise. As a condition to exercising the rights and licenses 72 | granted hereunder, each Recipient hereby assumes sole responsibility 73 | to secure any other intellectual property rights needed, if any. For 74 | example, if a third party patent license is required to allow 75 | Recipient to distribute the Program, it is Recipient's responsibility 76 | to acquire that license before distributing the Program. 77 | 78 | d) Each Contributor represents that to its knowledge it has sufficient 79 | copyright rights in its Contribution, if any, to grant the copyright 80 | license set forth in this Agreement. 81 | 82 | 3. REQUIREMENTS 83 | 84 | A Contributor may choose to distribute the Program in object code form 85 | under its own license agreement, provided that: 86 | 87 | a) it complies with the terms and conditions of this Agreement; and 88 | 89 | b) its license agreement: 90 | 91 | i) effectively disclaims on behalf of all Contributors all warranties 92 | and conditions, express and implied, including warranties or 93 | conditions of title and non-infringement, and implied warranties or 94 | conditions of merchantability and fitness for a particular purpose; 95 | 96 | ii) effectively excludes on behalf of all Contributors all liability 97 | for damages, including direct, indirect, special, incidental and 98 | consequential damages, such as lost profits; 99 | 100 | iii) states that any provisions which differ from this Agreement are 101 | offered by that Contributor alone and not by any other party; and 102 | 103 | iv) states that source code for the Program is available from such 104 | Contributor, and informs licensees how to obtain it in a reasonable 105 | manner on or through a medium customarily used for software exchange. 106 | 107 | When the Program is made available in source code form: 108 | 109 | a) it must be made available under this Agreement; and 110 | 111 | b) a copy of this Agreement must be included with each copy of the 112 | Program. 113 | 114 | Contributors may not remove or alter any copyright notices contained 115 | within the Program. 116 | 117 | Each Contributor must identify itself as the originator of its 118 | Contribution, if any, in a manner that reasonably allows subsequent 119 | Recipients to identify the originator of the Contribution. 120 | 121 | 4. COMMERCIAL DISTRIBUTION 122 | 123 | Commercial distributors of software may accept certain 124 | responsibilities with respect to end users, business partners and the 125 | like. While this license is intended to facilitate the commercial use 126 | of the Program, the Contributor who includes the Program in a 127 | commercial product offering should do so in a manner which does not 128 | create potential liability for other Contributors. Therefore, if a 129 | Contributor includes the Program in a commercial product offering, 130 | such Contributor ("Commercial Contributor") hereby agrees to defend 131 | and indemnify every other Contributor ("Indemnified Contributor") 132 | against any losses, damages and costs (collectively "Losses") arising 133 | from claims, lawsuits and other legal actions brought by a third party 134 | against the Indemnified Contributor to the extent caused by the acts 135 | or omissions of such Commercial Contributor in connection with its 136 | distribution of the Program in a commercial product offering. The 137 | obligations in this section do not apply to any claims or Losses 138 | relating to any actual or alleged intellectual property infringement. 139 | In order to qualify, an Indemnified Contributor must: a) promptly 140 | notify the Commercial Contributor in writing of such claim, and b) 141 | allow the Commercial Contributor to control, and cooperate with the 142 | Commercial Contributor in, the defense and any related settlement 143 | negotiations. The Indemnified Contributor may participate in any such 144 | claim at its own expense. 145 | 146 | For example, a Contributor might include the Program in a commercial 147 | product offering, Product X. That Contributor is then a Commercial 148 | Contributor. If that Commercial Contributor then makes performance 149 | claims, or offers warranties related to Product X, those performance 150 | claims and warranties are such Commercial Contributor's responsibility 151 | alone. Under this section, the Commercial Contributor would have to 152 | defend claims against the other Contributors related to those 153 | performance claims and warranties, and if a court requires any other 154 | Contributor to pay any damages as a result, the Commercial Contributor 155 | must pay those damages. 156 | 157 | 5. NO WARRANTY 158 | 159 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS 160 | PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 161 | KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY 162 | WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY 163 | OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely 164 | responsible for determining the appropriateness of using and 165 | distributing the Program and assumes all risks associated with its 166 | exercise of rights under this Agreement , including but not limited to 167 | the risks and costs of program errors, compliance with applicable 168 | laws, damage to or loss of data, programs or equipment, and 169 | unavailability or interruption of operations. 170 | 171 | 6. DISCLAIMER OF LIABILITY 172 | 173 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR 174 | ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, 175 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING 176 | WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF 177 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 178 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR 179 | DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 180 | HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 181 | 182 | 7. GENERAL 183 | 184 | If any provision of this Agreement is invalid or unenforceable under 185 | applicable law, it shall not affect the validity or enforceability of 186 | the remainder of the terms of this Agreement, and without further 187 | action by the parties hereto, such provision shall be reformed to the 188 | minimum extent necessary to make such provision valid and enforceable. 189 | 190 | If Recipient institutes patent litigation against any entity 191 | (including a cross-claim or counterclaim in a lawsuit) alleging that 192 | the Program itself (excluding combinations of the Program with other 193 | software or hardware) infringes such Recipient's patent(s), then such 194 | Recipient's rights granted under Section 2(b) shall terminate as of 195 | the date such litigation is filed. 196 | 197 | All Recipient's rights under this Agreement shall terminate if it 198 | fails to comply with any of the material terms or conditions of this 199 | Agreement and does not cure such failure in a reasonable period of 200 | time after becoming aware of such noncompliance. If all Recipient's 201 | rights under this Agreement terminate, Recipient agrees to cease use 202 | and distribution of the Program as soon as reasonably practicable. 203 | However, Recipient's obligations under this Agreement and any licenses 204 | granted by Recipient relating to the Program shall continue and 205 | survive. 206 | 207 | Everyone is permitted to copy and distribute copies of this Agreement, 208 | but in order to avoid inconsistency the Agreement is copyrighted and 209 | may only be modified in the following manner. The Agreement Steward 210 | reserves the right to publish new versions (including revisions) of 211 | this Agreement from time to time. No one other than the Agreement 212 | Steward has the right to modify this Agreement. The Eclipse Foundation 213 | is the initial Agreement Steward. The Eclipse Foundation may assign 214 | the responsibility to serve as the Agreement Steward to a suitable 215 | separate entity. Each new version of the Agreement will be given a 216 | distinguishing version number. The Program (including Contributions) 217 | may always be distributed subject to the version of the Agreement 218 | under which it was received. In addition, after a new version of the 219 | Agreement is published, Contributor may elect to distribute the 220 | Program (including its Contributions) under the new version. Except as 221 | expressly stated in Sections 2(a) and 2(b) above, Recipient receives 222 | no rights or licenses to the intellectual property of any Contributor 223 | under this Agreement, whether expressly, by implication, estoppel or 224 | otherwise. All rights in the Program not expressly granted under this 225 | Agreement are reserved. 226 | 227 | This Agreement is governed by the laws of the State of New York and 228 | the intellectual property laws of the United States of America. No 229 | party to this Agreement will bring a legal action under this Agreement 230 | more than one year after the cause of action arose. Each party waives 231 | its rights to a jury trial in any resulting litigation. 232 | 233 | -------------------------------------------------------------------------- 234 | 235 | Apache License 236 | Version 2.0, January 2004 237 | http://www.apache.org/licenses/ 238 | 239 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 240 | 241 | 1. Definitions. 242 | 243 | "License" shall mean the terms and conditions for use, reproduction, 244 | and distribution as defined by Sections 1 through 9 of this document. 245 | 246 | "Licensor" shall mean the copyright owner or entity authorized by 247 | the copyright owner that is granting the License. 248 | 249 | "Legal Entity" shall mean the union of the acting entity and all 250 | other entities that control, are controlled by, or are under common 251 | control with that entity. For the purposes of this definition, 252 | "control" means (i) the power, direct or indirect, to cause the 253 | direction or management of such entity, whether by contract or 254 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 255 | outstanding shares, or (iii) beneficial ownership of such entity. 256 | 257 | "You" (or "Your") shall mean an individual or Legal Entity 258 | exercising permissions granted by this License. 259 | 260 | "Source" form shall mean the preferred form for making modifications, 261 | including but not limited to software source code, documentation 262 | source, and configuration files. 263 | 264 | "Object" form shall mean any form resulting from mechanical 265 | transformation or translation of a Source form, including but 266 | not limited to compiled object code, generated documentation, 267 | and conversions to other media types. 268 | 269 | "Work" shall mean the work of authorship, whether in Source or 270 | Object form, made available under the License, as indicated by a 271 | copyright notice that is included in or attached to the work 272 | (an example is provided in the Appendix below). 273 | 274 | "Derivative Works" shall mean any work, whether in Source or Object 275 | form, that is based on (or derived from) the Work and for which the 276 | editorial revisions, annotations, elaborations, or other modifications 277 | represent, as a whole, an original work of authorship. For the purposes 278 | of this License, Derivative Works shall not include works that remain 279 | separable from, or merely link (or bind by name) to the interfaces of, 280 | the Work and Derivative Works thereof. 281 | 282 | "Contribution" shall mean any work of authorship, including 283 | the original version of the Work and any modifications or additions 284 | to that Work or Derivative Works thereof, that is intentionally 285 | submitted to Licensor for inclusion in the Work by the copyright owner 286 | or by an individual or Legal Entity authorized to submit on behalf of 287 | the copyright owner. For the purposes of this definition, "submitted" 288 | means any form of electronic, verbal, or written communication sent 289 | to the Licensor or its representatives, including but not limited to 290 | communication on electronic mailing lists, source code control systems, 291 | and issue tracking systems that are managed by, or on behalf of, the 292 | Licensor for the purpose of discussing and improving the Work, but 293 | excluding communication that is conspicuously marked or otherwise 294 | designated in writing by the copyright owner as "Not a Contribution." 295 | 296 | "Contributor" shall mean Licensor and any individual or Legal Entity 297 | on behalf of whom a Contribution has been received by Licensor and 298 | subsequently incorporated within the Work. 299 | 300 | 2. Grant of Copyright License. Subject to the terms and conditions of 301 | this License, each Contributor hereby grants to You a perpetual, 302 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 303 | copyright license to reproduce, prepare Derivative Works of, 304 | publicly display, publicly perform, sublicense, and distribute the 305 | Work and such Derivative Works in Source or Object form. 306 | 307 | 3. Grant of Patent License. Subject to the terms and conditions of 308 | this License, each Contributor hereby grants to You a perpetual, 309 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 310 | (except as stated in this section) patent license to make, have made, 311 | use, offer to sell, sell, import, and otherwise transfer the Work, 312 | where such license applies only to those patent claims licensable 313 | by such Contributor that are necessarily infringed by their 314 | Contribution(s) alone or by combination of their Contribution(s) 315 | with the Work to which such Contribution(s) was submitted. If You 316 | institute patent litigation against any entity (including a 317 | cross-claim or counterclaim in a lawsuit) alleging that the Work 318 | or a Contribution incorporated within the Work constitutes direct 319 | or contributory patent infringement, then any patent licenses 320 | granted to You under this License for that Work shall terminate 321 | as of the date such litigation is filed. 322 | 323 | 4. Redistribution. You may reproduce and distribute copies of the 324 | Work or Derivative Works thereof in any medium, with or without 325 | modifications, and in Source or Object form, provided that You 326 | meet the following conditions: 327 | 328 | (a) You must give any other recipients of the Work or 329 | Derivative Works a copy of this License; and 330 | 331 | (b) You must cause any modified files to carry prominent notices 332 | stating that You changed the files; and 333 | 334 | (c) You must retain, in the Source form of any Derivative Works 335 | that You distribute, all copyright, patent, trademark, and 336 | attribution notices from the Source form of the Work, 337 | excluding those notices that do not pertain to any part of 338 | the Derivative Works; and 339 | 340 | (d) If the Work includes a "NOTICE" text file as part of its 341 | distribution, then any Derivative Works that You distribute must 342 | include a readable copy of the attribution notices contained 343 | within such NOTICE file, excluding those notices that do not 344 | pertain to any part of the Derivative Works, in at least one 345 | of the following places: within a NOTICE text file distributed 346 | as part of the Derivative Works; within the Source form or 347 | documentation, if provided along with the Derivative Works; or, 348 | within a display generated by the Derivative Works, if and 349 | wherever such third-party notices normally appear. The contents 350 | of the NOTICE file are for informational purposes only and 351 | do not modify the License. You may add Your own attribution 352 | notices within Derivative Works that You distribute, alongside 353 | or as an addendum to the NOTICE text from the Work, provided 354 | that such additional attribution notices cannot be construed 355 | as modifying the License. 356 | 357 | You may add Your own copyright statement to Your modifications and 358 | may provide additional or different license terms and conditions 359 | for use, reproduction, or distribution of Your modifications, or 360 | for any such Derivative Works as a whole, provided Your use, 361 | reproduction, and distribution of the Work otherwise complies with 362 | the conditions stated in this License. 363 | 364 | 5. Submission of Contributions. Unless You explicitly state otherwise, 365 | any Contribution intentionally submitted for inclusion in the Work 366 | by You to the Licensor shall be under the terms and conditions of 367 | this License, without any additional terms or conditions. 368 | Notwithstanding the above, nothing herein shall supersede or modify 369 | the terms of any separate license agreement you may have executed 370 | with Licensor regarding such Contributions. 371 | 372 | 6. Trademarks. This License does not grant permission to use the trade 373 | names, trademarks, service marks, or product names of the Licensor, 374 | except as required for reasonable and customary use in describing the 375 | origin of the Work and reproducing the content of the NOTICE file. 376 | 377 | 7. Disclaimer of Warranty. Unless required by applicable law or 378 | agreed to in writing, Licensor provides the Work (and each 379 | Contributor provides its Contributions) on an "AS IS" BASIS, 380 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 381 | implied, including, without limitation, any warranties or conditions 382 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 383 | PARTICULAR PURPOSE. You are solely responsible for determining the 384 | appropriateness of using or redistributing the Work and assume any 385 | risks associated with Your exercise of permissions under this License. 386 | 387 | 8. Limitation of Liability. In no event and under no legal theory, 388 | whether in tort (including negligence), contract, or otherwise, 389 | unless required by applicable law (such as deliberate and grossly 390 | negligent acts) or agreed to in writing, shall any Contributor be 391 | liable to You for damages, including any direct, indirect, special, 392 | incidental, or consequential damages of any character arising as a 393 | result of this License or out of the use or inability to use the 394 | Work (including but not limited to damages for loss of goodwill, 395 | work stoppage, computer failure or malfunction, or any and all 396 | other commercial damages or losses), even if such Contributor 397 | has been advised of the possibility of such damages. 398 | 399 | 9. Accepting Warranty or Additional Liability. While redistributing 400 | the Work or Derivative Works thereof, You may choose to offer, 401 | and charge a fee for, acceptance of support, warranty, indemnity, 402 | or other liability obligations and/or rights consistent with this 403 | License. However, in accepting such obligations, You may act only 404 | on Your own behalf and on Your sole responsibility, not on behalf 405 | of any other Contributor, and only if You agree to indemnify, 406 | defend, and hold each Contributor harmless for any liability 407 | incurred by, or claims asserted against, such Contributor by reason 408 | of your accepting any such warranty or additional liability. 409 | 410 | END OF TERMS AND CONDITIONS 411 | 412 | APPENDIX: How to apply the Apache License to your work. 413 | 414 | To apply the Apache License to your work, attach the following 415 | boilerplate notice, with the fields enclosed by brackets "[]" 416 | replaced with your own identifying information. (Don't include 417 | the brackets!) The text should be enclosed in the appropriate 418 | comment syntax for the file format. We also recommend that a 419 | file or class name and description of purpose be included on the 420 | same "printed page" as the copyright notice for easier 421 | identification within third-party archives. 422 | 423 | Copyright [yyyy] [name of copyright owner] 424 | 425 | Licensed under the Apache License, Version 2.0 (the "License"); 426 | you may not use this file except in compliance with the License. 427 | You may obtain a copy of the License at 428 | 429 | http://www.apache.org/licenses/LICENSE-2.0 430 | 431 | Unless required by applicable law or agreed to in writing, software 432 | distributed under the License is distributed on an "AS IS" BASIS, 433 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 434 | See the License for the specific language governing permissions and 435 | limitations under the License. 436 | -------------------------------------------------------------------------------- /mvnsh-assembly/src/main/resources/README.txt: -------------------------------------------------------------------------------- 1 | # Maven Shell 2 | 3 | Please see the following URLs for more information: 4 | 5 | * http://github.com/jdillon/mvnsh 6 | -------------------------------------------------------------------------------- /mvnsh-assembly/src/main/resources/bin/mvnsh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | BOOTSCRIPT="$HOME/.m2/mvnsh.boot" 4 | if [ -f "$BOOTSCRIPT" ] ; then 5 | . "$BOOTSCRIPT" 6 | fi 7 | 8 | # OS specific support (must be 'true' or 'false'). 9 | cygwin=false; 10 | case "`uname`" in 11 | CYGWIN*) 12 | cygwin=true 13 | ;; 14 | esac 15 | 16 | # For Cygwin, ensure paths are in UNIX format before anything is touched 17 | if $cygwin ; then 18 | [ -n "$SHELL_HOME" ] && SHELL_HOME=`cygpath --unix "$SHELL_HOME"` 19 | [ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"` 20 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 21 | fi 22 | 23 | # resolve links - $0 may be a soft-link 24 | PRG="$0" 25 | 26 | while [ -h "$PRG" ] ; do 27 | ls=`ls -ld "$PRG"` 28 | link=`expr "$ls" : '.*-> \(.*\)$'` 29 | if expr "$link" : '/.*' > /dev/null; then 30 | PRG="$link" 31 | else 32 | PRG=`dirname "$PRG"`/"$link" 33 | fi 34 | done 35 | 36 | DIRNAME=`dirname "$PRG"` 37 | 38 | # Locate SHELL_HOME if not it is not set 39 | if [ -z "$SHELL_HOME" ]; then 40 | SHELL_HOME=`cd "$DIRNAME/.."; pwd` 41 | fi 42 | 43 | # Determine the Java command to use to start the JVM 44 | if [ -z "$JAVACMD" ]; then 45 | if [ -n "$JAVA_HOME" ]; then 46 | JAVACMD="$JAVA_HOME/bin/java" 47 | else 48 | JAVACMD="java" 49 | fi 50 | fi 51 | 52 | BOOTJAR="$SHELL_HOME/boot/bootstrap.jar" 53 | if $cygwin ; then 54 | BOOTJAR=`cygpath --windows "$BOOTJAR"` 55 | fi 56 | 57 | COMMAND="" 58 | 59 | exec "$JAVACMD" $MAVEN_OPTS -jar "$BOOTJAR" $SHELL_OPTS $COMMAND "$@" 60 | 61 | -------------------------------------------------------------------------------- /mvnsh-assembly/src/main/resources/bin/mvnsh.bat: -------------------------------------------------------------------------------- 1 | @if "%SHELL_DEBUG%" == "" @echo off 2 | 3 | if "%OS%"=="Windows_NT" setlocal enableextensions 4 | 5 | :begin 6 | 7 | set DIRNAME=%~dp0 8 | if "%DIRNAME%" == "" set DIRNAME=.\ 9 | 10 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 11 | 12 | set BOOTSCRIPT=%HOME%\.m2\mvnsh.boot.bat 13 | if exist "%BOOTSCRIPT%" call "%BOOTSCRIPT%" 14 | 15 | :check_JAVACMD 16 | if not "%JAVACMD%" == "" goto check_SHELL_HOME 17 | 18 | :check_JAVA_HOME 19 | if not "%JAVA_HOME%" == "" goto have_JAVA_HOME 20 | set JAVACMD=java 21 | goto check_SHELL_HOME 22 | 23 | :have_JAVA_HOME 24 | set JAVACMD=%JAVA_HOME%\bin\java 25 | goto check_SHELL_HOME 26 | 27 | :check_SHELL_HOME 28 | if "%SHELL_HOME%" == "" set SHELL_HOME=%DIRNAME%.. 29 | 30 | :init 31 | @REM Get command-line arguments, handling Windowz variants 32 | if not "%OS%" == "Windows_NT" goto win9xME_args 33 | if "%eval[2+2]" == "4" goto 4NT_args 34 | 35 | @REM Regular WinNT shell 36 | set ARGS=%* 37 | goto execute 38 | 39 | :win9xME_args 40 | @REM Slurp the command line arguments. This loop allows for an unlimited number 41 | set ARGS= 42 | 43 | :win9xME_args_slurp 44 | if "x%1" == "x" goto execute 45 | set ARGS=%ARGS% %1 46 | shift 47 | goto win9xME_args_slurp 48 | 49 | :4NT_args 50 | @REM Get arguments from the 4NT Shell from JP Software 51 | set ARGS=%$ 52 | 53 | :execute 54 | 55 | set BOOTJAR=%SHELL_HOME%\boot\bootstrap.jar 56 | 57 | set COMMAND= 58 | 59 | @REM Start the JVM 60 | "%JAVACMD%" %MAVEN_OPTS% -jar "%BOOTJAR%" %COMMAND% %ARGS% 61 | 62 | :end 63 | 64 | if "%OS%"=="Windows_NT" endlocal 65 | if "%SHELL_BATCH_PAUSE%" == "on" pause 66 | if "%SHELL_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 67 | 68 | cmd /C exit /B %ERRORLEVEL% 69 | -------------------------------------------------------------------------------- /mvnsh-assembly/src/main/resources/bin/mvnx: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | BOOTSCRIPT="$HOME/.m2/mvnsh.boot" 4 | if [ -f "$BOOTSCRIPT" ] ; then 5 | . "$BOOTSCRIPT" 6 | fi 7 | 8 | # OS specific support (must be 'true' or 'false'). 9 | cygwin=false; 10 | case "`uname`" in 11 | CYGWIN*) 12 | cygwin=true 13 | ;; 14 | esac 15 | 16 | # For Cygwin, ensure paths are in UNIX format before anything is touched 17 | if $cygwin ; then 18 | [ -n "$SHELL_HOME" ] && SHELL_HOME=`cygpath --unix "$SHELL_HOME"` 19 | [ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"` 20 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 21 | fi 22 | 23 | # resolve links - $0 may be a soft-link 24 | PRG="$0" 25 | 26 | while [ -h "$PRG" ] ; do 27 | ls=`ls -ld "$PRG"` 28 | link=`expr "$ls" : '.*-> \(.*\)$'` 29 | if expr "$link" : '/.*' > /dev/null; then 30 | PRG="$link" 31 | else 32 | PRG=`dirname "$PRG"`/"$link" 33 | fi 34 | done 35 | 36 | DIRNAME=`dirname "$PRG"` 37 | 38 | # Locate SHELL_HOME if not it is not set 39 | if [ -z "$SHELL_HOME" ]; then 40 | SHELL_HOME=`cd "$DIRNAME/.."; pwd` 41 | fi 42 | 43 | # Determine the Java command to use to start the JVM 44 | if [ -z "$JAVACMD" ]; then 45 | if [ -n "$JAVA_HOME" ]; then 46 | JAVACMD="$JAVA_HOME/bin/java" 47 | else 48 | JAVACMD="java" 49 | fi 50 | fi 51 | 52 | BOOTJAR="$SHELL_HOME/boot/bootstrap.jar" 53 | if $cygwin ; then 54 | BOOTJAR=`cygpath --windows "$BOOTJAR"` 55 | fi 56 | 57 | COMMAND="mvn -- " 58 | 59 | exec "$JAVACMD" $MAVEN_OPTS -jar "$BOOTJAR" $SHELL_OPTS $COMMAND "$@" 60 | 61 | -------------------------------------------------------------------------------- /mvnsh-assembly/src/main/resources/bin/mvnx.bat: -------------------------------------------------------------------------------- 1 | @if "%SHELL_DEBUG%" == "" @echo off 2 | 3 | if "%OS%"=="Windows_NT" setlocal enableextensions 4 | 5 | :begin 6 | 7 | set DIRNAME=%~dp0 8 | if "%DIRNAME%" == "" set DIRNAME=.\ 9 | 10 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 11 | 12 | set BOOTSCRIPT=%HOME%\.m2\mvnsh.boot.bat 13 | if exist "%BOOTSCRIPT%" call "%BOOTSCRIPT%" 14 | 15 | :check_JAVACMD 16 | if not "%JAVACMD%" == "" goto check_SHELL_HOME 17 | 18 | :check_JAVA_HOME 19 | if not "%JAVA_HOME%" == "" goto have_JAVA_HOME 20 | set JAVACMD=java 21 | goto check_SHELL_HOME 22 | 23 | :have_JAVA_HOME 24 | set JAVACMD=%JAVA_HOME%\bin\java 25 | goto check_SHELL_HOME 26 | 27 | :check_SHELL_HOME 28 | if "%SHELL_HOME%" == "" set SHELL_HOME=%DIRNAME%.. 29 | 30 | :init 31 | @REM Get command-line arguments, handling Windowz variants 32 | if not "%OS%" == "Windows_NT" goto win9xME_args 33 | if "%eval[2+2]" == "4" goto 4NT_args 34 | 35 | @REM Regular WinNT shell 36 | set ARGS=%* 37 | goto execute 38 | 39 | :win9xME_args 40 | @REM Slurp the command line arguments. This loop allows for an unlimited number 41 | set ARGS= 42 | 43 | :win9xME_args_slurp 44 | if "x%1" == "x" goto execute 45 | set ARGS=%ARGS% %1 46 | shift 47 | goto win9xME_args_slurp 48 | 49 | :4NT_args 50 | @REM Get arguments from the 4NT Shell from JP Software 51 | set ARGS=%$ 52 | 53 | :execute 54 | 55 | set BOOTJAR=%SHELL_HOME%\boot\bootstrap.jar 56 | 57 | set COMMAND=mvn -- 58 | 59 | @REM Start the JVM 60 | "%JAVACMD%" %MAVEN_OPTS% -jar "%BOOTJAR%" %COMMAND% %ARGS% 61 | 62 | :end 63 | 64 | if "%OS%"=="Windows_NT" endlocal 65 | if "%SHELL_BATCH_PAUSE%" == "on" pause 66 | if "%SHELL_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 67 | 68 | cmd /C exit /B %ERRORLEVEL% 69 | -------------------------------------------------------------------------------- /mvnsh-assembly/src/main/resources/etc/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | default 5 | 6 | 7 | true 8 | 9 | 10 | 11 | 12 | 13 | ${shell.logging.console.pattern:-[%level] %m%n} 14 | 15 | 16 | ${shell.logging.console.threshold:-INFO} 17 | 18 | 19 | 20 | 21 | ${shell.logging.file.path:-${shell.home}/log/shell.log} 22 | ${shell.logging.file.append:-false} 23 | 24 | ${shell.logging.file.pattern:-%date %level [%thread%X{DC}] %logger - %msg%n} 25 | 26 | 27 | ${shell.logging.file.threshold:-INFO} 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /mvnsh-assembly/src/main/resources/etc/mvnsh.profile: -------------------------------------------------------------------------------- 1 | alias dir ls 2 | -------------------------------------------------------------------------------- /mvnsh-assembly/src/main/resources/examples/mvnsh.rc: -------------------------------------------------------------------------------- 1 | # 2 | # Example ~/.m2/mvnsh.rc 3 | # 4 | 5 | # Some niceties 6 | alias ? help 7 | alias ! recall 8 | alias . source 9 | alias quit exit 10 | alias bye exit 11 | alias print echo 12 | 13 | # Some aliases to run common goals 14 | alias install mvn install 15 | alias clean mvn clean 16 | alias compile mvn compile 17 | alias test mvn test 18 | 19 | # Aliases to the mvn help plugin 20 | alias help-system mvn org.apache.maven.plugins:maven-help-plugin:system 21 | alias help-allprofiles mvn org.apache.maven.plugins:maven-help-plugin:all-profiles 22 | alias help-effectivesettings mvn org.apache.maven.plugins:maven-help-plugin:effective-settings 23 | 24 | # Aliases to the mvn dependency plugin 25 | alias dependency-analyze mvn org.apache.maven.plugins:maven-dependency-plugin:analyze 26 | alias dependency-resolve mvn org.apache.maven.plugins:maven-dependency-plugin:resolve 27 | alias dependency-tree mvn org.apache.maven.plugins:maven-dependency-plugin:tree 28 | alias dependency-purge mvn org.apache.maven.plugins:maven-dependency-plugin:purge-local-repository 29 | alias dependency-resolve-plugins mvn org.apache.maven.plugins:maven-dependency-plugin:resolve-plugins 30 | -------------------------------------------------------------------------------- /mvnsh-bootstrap/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 21 | 22 | 4.0.0 23 | 24 | 25 | com.planet57.maven.shell 26 | mvnsh 27 | 1.2.0-SNAPSHOT 28 | 29 | 30 | mvnsh-bootstrap 31 | ${project.groupId}:${project.artifactId} 32 | 33 | 34 | 35 | com.planet57.gshell 36 | gshell-launcher 37 | provided 38 | 39 | 40 | 41 | 42 | 43 | 44 | org.apache.maven.plugins 45 | maven-dependency-plugin 46 | 47 | 48 | compile 49 | 50 | unpack 51 | 52 | 53 | 54 | 55 | com.planet57.gshell 56 | gshell-launcher 57 | 58 | 59 | ${project.build.outputDirectory} 60 | META-INF/maven/** 61 | 62 | 63 | 64 | 65 | 66 | 67 | org.apache.maven.plugins 68 | maven-jar-plugin 69 | 70 | 71 | ${project.build.outputDirectory}/META-INF/MANIFEST.MF 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /mvnsh-bootstrap/src/main/filtered-resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2009-present the original author or authors. 3 | # 4 | # All rights reserved. This program and the accompanying materials 5 | # are made available under the terms of the Eclipse Public License v1.0 6 | # and Apache License v2.0 which accompanies this distribution. 7 | # 8 | # The Eclipse Public License is available at 9 | # http://www.eclipse.org/legal/epl-v10.html 10 | # 11 | # The Apache License v2.0 is available at 12 | # http://www.apache.org/licenses/LICENSE-2.0.html 13 | # 14 | # You may elect to redistribute this code under either of these licenses. 15 | # 16 | 17 | shell.main=com.planet57.maven.shell.Main 18 | shell.program=mvnsh 19 | shell.version=${project.version},${build.timestamp} 20 | shell.lib=${shell.home}/lib 21 | -------------------------------------------------------------------------------- /mvnsh-commands/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 21 | 22 | 4.0.0 23 | 24 | 25 | com.planet57.maven.shell 26 | mvnsh 27 | 1.2.0-SNAPSHOT 28 | 29 | 30 | mvnsh-commands 31 | ${project.groupId}:${project.artifactId} 32 | 33 | 34 | 35 | com.planet57.gshell 36 | gshell-api 37 | provided 38 | 39 | 40 | 41 | com.planet57.gshell.ext 42 | gshell-plexus 43 | 44 | 45 | 46 | org.apache.maven 47 | maven-embedder 48 | 49 | 50 | 51 | org.apache.maven 52 | maven-compat 53 | 54 | 55 | 56 | org.apache.maven.resolver 57 | maven-resolver-connector-basic 58 | 59 | 60 | 61 | org.apache.maven.resolver 62 | maven-resolver-transport-wagon 63 | 64 | 65 | 66 | org.apache.maven.wagon 67 | wagon-file 68 | 69 | 70 | 71 | org.apache.maven.wagon 72 | wagon-http 73 | shaded 74 | 75 | 76 | commons-logging 77 | commons-logging 78 | 79 | 80 | 81 | 82 | 83 | org.fusesource.jansi 84 | jansi 85 | 86 | 87 | 88 | com.planet57.gshell 89 | gshell-testharness 90 | test 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /mvnsh-commands/src/main/java/com/planet57/maven/shell/commands/maven/EncryptPasswordAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-present the original author or authors. 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * and Apache License v2.0 which accompanies this distribution. 7 | * 8 | * The Eclipse Public License is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * The Apache License v2.0 is available at 12 | * http://www.apache.org/licenses/LICENSE-2.0.html 13 | * 14 | * You may elect to redistribute this code under either of these licenses. 15 | */ 16 | package com.planet57.maven.shell.commands.maven; 17 | 18 | import java.util.Properties; 19 | 20 | import com.planet57.gshell.variables.VariableNames; 21 | import com.planet57.gshell.variables.Variables; 22 | import org.sonatype.plexus.components.cipher.DefaultPlexusCipher; 23 | import org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher; 24 | import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; 25 | import org.sonatype.plexus.components.sec.dispatcher.SecUtil; 26 | import org.sonatype.plexus.components.sec.dispatcher.model.SettingsSecurity; 27 | 28 | import com.planet57.gshell.command.Command; 29 | import com.planet57.gshell.command.CommandContext; 30 | import com.planet57.gshell.util.io.IO; 31 | import com.planet57.gshell.command.CommandActionSupport; 32 | import com.planet57.gshell.plexus.PlexusRuntime; 33 | import com.planet57.gshell.util.NameValue; 34 | import com.planet57.gshell.util.cli2.Argument; 35 | import com.planet57.gshell.util.cli2.Option; 36 | import com.planet57.gshell.util.pref.Preferences; 37 | 38 | import javax.annotation.Nonnull; 39 | import javax.annotation.Nullable; 40 | import javax.inject.Inject; 41 | 42 | import static com.google.common.base.Preconditions.checkNotNull; 43 | import static com.google.common.base.Preconditions.checkState; 44 | import static org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION; 45 | 46 | /** 47 | * Encrypt passwords. 48 | * 49 | * @author Jason Dillon 50 | * @since 0.9 51 | */ 52 | @Command(name = "encrypt-password", description = "Encrypt passwords") 53 | @Preferences(path = "commands/encrypt-password") 54 | public class EncryptPasswordAction 55 | extends CommandActionSupport 56 | { 57 | private final PlexusRuntime plexus; 58 | 59 | @Nullable 60 | private Properties props; 61 | 62 | @Option(name = "D", longName = "define", description = "Define a system property", token = "NAME=[VALUE]") 63 | protected void setProperty(final String input) { 64 | checkNotNull(input); 65 | 66 | if (props == null) { 67 | props = new Properties(); 68 | } 69 | 70 | NameValue nv = NameValue.parse(input); 71 | props.setProperty(nv.name, nv.value); 72 | } 73 | 74 | @Option(name = "m", longName = "master", description = "Encrypt master security settings") 75 | private boolean master; 76 | 77 | @Argument(required = true, description = "Password to encrypt", token = "PASSWORD") 78 | private String password; 79 | 80 | @Inject 81 | public EncryptPasswordAction(final PlexusRuntime plexus) { 82 | this.plexus = checkNotNull(plexus); 83 | } 84 | 85 | @Override 86 | public Object execute(@Nonnull final CommandContext context) throws Exception { 87 | IO io = context.getIo(); 88 | Variables variables = context.getVariables(); 89 | 90 | // HACK: Put all props into System, the security muck needs it 91 | if (props != null) { 92 | System.getProperties().putAll(props); 93 | } 94 | 95 | DefaultSecDispatcher dispatcher = (DefaultSecDispatcher) plexus.lookup(SecDispatcher.class, "maven"); 96 | String result; 97 | 98 | if (master) { 99 | DefaultPlexusCipher cipher = new DefaultPlexusCipher(); 100 | result = cipher.encryptAndDecorate(password, SYSTEM_PROPERTY_SEC_LOCATION); 101 | } 102 | else { 103 | String configFile = System.getProperty(SYSTEM_PROPERTY_SEC_LOCATION); 104 | if (configFile == null) { 105 | configFile = dispatcher.getConfigurationFile(); 106 | if (configFile.startsWith("~")) { 107 | configFile = variables.get(VariableNames.SHELL_USER_HOME, String.class) + configFile.substring(1); 108 | } 109 | } 110 | 111 | log.debug("Reading config-file: {}", configFile); 112 | SettingsSecurity sec = SecUtil.read(configFile, true); 113 | String master = null; 114 | if (sec != null) { 115 | master = sec.getMaster(); 116 | } 117 | checkState(master != null, "Master password is not set in the setting security file: %s", configFile); 118 | 119 | DefaultPlexusCipher cipher = new DefaultPlexusCipher(); 120 | String masterPasswd = cipher.decryptDecorated(master, SYSTEM_PROPERTY_SEC_LOCATION); 121 | 122 | result = cipher.encryptAndDecorate(password, masterPasswd); 123 | } 124 | 125 | io.println(result); 126 | 127 | // maven core-its need 0 for success 128 | return null; 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /mvnsh-commands/src/main/java/com/planet57/maven/shell/commands/maven/MavenAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-present the original author or authors. 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * and Apache License v2.0 which accompanies this distribution. 7 | * 8 | * The Eclipse Public License is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * The Apache License v2.0 is available at 12 | * http://www.apache.org/licenses/LICENSE-2.0.html 13 | * 14 | * You may elect to redistribute this code under either of these licenses. 15 | */ 16 | package com.planet57.maven.shell.commands.maven; 17 | 18 | import java.io.File; 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import com.planet57.gshell.command.Command; 23 | import com.planet57.gshell.command.CommandContext; 24 | import com.planet57.gshell.command.CommandActionSupport; 25 | import com.planet57.gshell.util.cli2.OpaqueArguments; 26 | import com.planet57.gshell.util.pref.Preferences; 27 | import com.planet57.gshell.variables.Variables; 28 | import org.apache.maven.cli.CliRequestBuilder; 29 | import org.apache.maven.cli.MavenCli; 30 | import org.codehaus.plexus.classworlds.ClassWorld; 31 | import org.jline.reader.Completer; 32 | 33 | import javax.annotation.Nonnull; 34 | import javax.inject.Inject; 35 | import javax.inject.Provider; 36 | 37 | import static com.google.common.base.Preconditions.checkNotNull; 38 | import static com.planet57.gshell.variables.VariableNames.SHELL_HOME; 39 | import static com.planet57.gshell.variables.VariableNames.SHELL_USER_DIR; 40 | 41 | /** 42 | * Execute Maven. 43 | * 44 | * @author Jason Dillon 45 | * @since 0.7 46 | */ 47 | @Command(name = "mvn", description = "Execute Maven") 48 | @Preferences(path = "commands/mvn") 49 | public class MavenAction 50 | extends CommandActionSupport 51 | implements OpaqueArguments 52 | { 53 | private final MavenCompleter completer; 54 | 55 | private final Provider classWorld; 56 | 57 | @Inject 58 | public MavenAction(final Provider classWorld, final MavenCompleter completer) { 59 | this.classWorld = checkNotNull(classWorld); 60 | this.completer = checkNotNull(completer); 61 | } 62 | 63 | @Override 64 | protected Completer discoverCompleter() { 65 | return completer; 66 | } 67 | 68 | @Override 69 | public Object execute(@Nonnull final CommandContext context) throws Exception { 70 | Variables variables = context.getVariables(); 71 | 72 | CliRequestBuilder request = new CliRequestBuilder(); 73 | request.setArguments(strings(context.getArguments())); 74 | 75 | File baseDir = variables.require(SHELL_USER_DIR, File.class); 76 | request.setWorkingDirectory(baseDir); 77 | 78 | File projectDir = variables.get(MavenCli.MULTIMODULE_PROJECT_DIRECTORY, File.class, null); 79 | if (projectDir == null) { 80 | projectDir = findRootProjectDir(baseDir); 81 | } 82 | request.setProjectDirectory(projectDir); 83 | 84 | // a few parts of Maven expect "maven.home" system-property to be set 85 | File shellHome = variables.require(SHELL_HOME, File.class); 86 | System.setProperty("maven.home", shellHome.getAbsolutePath()); 87 | 88 | MavenCli cli = new MavenCli(classWorld.get()); 89 | return cli.doMain(request.build()); 90 | } 91 | 92 | /** 93 | * Convert object array to list of strings. 94 | */ 95 | private List strings(final Object[] input) { 96 | List result = new ArrayList<>(input.length); 97 | for (Object value : input) { 98 | result.add(String.valueOf(value)); 99 | } 100 | return result; 101 | } 102 | 103 | public List strings(final List input) { 104 | return strings(input.toArray()); 105 | } 106 | 107 | /** 108 | * Find the root project directory for given directory. 109 | */ 110 | private File findRootProjectDir(final File baseDir) { 111 | File dir = baseDir; 112 | while (dir != null) { 113 | File file = new File(dir, ".mvn"); 114 | if (file.isDirectory()) { 115 | return dir; 116 | } 117 | dir = dir.getParentFile(); 118 | } 119 | 120 | return baseDir; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /mvnsh-commands/src/main/java/com/planet57/maven/shell/commands/maven/MavenCompleter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-present the original author or authors. 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * and Apache License v2.0 which accompanies this distribution. 7 | * 8 | * The Eclipse Public License is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * The Apache License v2.0 is available at 12 | * http://www.apache.org/licenses/LICENSE-2.0.html 13 | * 14 | * You may elect to redistribute this code under either of these licenses. 15 | */ 16 | package com.planet57.maven.shell.commands.maven; 17 | 18 | import org.jline.reader.Candidate; 19 | import org.jline.reader.Completer; 20 | import org.jline.reader.LineReader; 21 | import org.jline.reader.ParsedLine; 22 | import org.jline.reader.impl.completer.AggregateCompleter; 23 | 24 | import javax.inject.Inject; 25 | import javax.inject.Named; 26 | import javax.inject.Singleton; 27 | import java.util.List; 28 | 29 | import static com.google.common.base.Preconditions.checkNotNull; 30 | 31 | /** 32 | * Completer for {@link MavenAction}. 33 | */ 34 | @Named 35 | @Singleton 36 | public class MavenCompleter 37 | implements Completer 38 | { 39 | private final Completer delegate; 40 | 41 | @Inject 42 | public MavenCompleter(@Named("maven-option") final Completer mavenOption, 43 | @Named("maven-phase") final Completer mavenPhase, 44 | @Named("maven-plugin-goal") final Completer mavenPluginGoal) 45 | { 46 | checkNotNull(mavenOption); 47 | checkNotNull(mavenPhase); 48 | checkNotNull(mavenPluginGoal); 49 | this.delegate = new AggregateCompleter(mavenOption, mavenPhase, mavenPluginGoal); 50 | } 51 | 52 | @Override 53 | public void complete(final LineReader reader, final ParsedLine line, final List candidates) { 54 | delegate.complete(reader, line, candidates); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /mvnsh-commands/src/main/java/com/planet57/maven/shell/commands/maven/MavenModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-present the original author or authors. 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * and Apache License v2.0 which accompanies this distribution. 7 | * 8 | * The Eclipse Public License is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * The Apache License v2.0 is available at 12 | * http://www.apache.org/licenses/LICENSE-2.0.html 13 | * 14 | * You may elect to redistribute this code under either of these licenses. 15 | */ 16 | 17 | package com.planet57.maven.shell.commands.maven; 18 | 19 | import com.google.inject.Binder; 20 | import com.google.inject.Module; 21 | import com.google.inject.Provides; 22 | import org.codehaus.plexus.classworlds.ClassWorld; 23 | 24 | import javax.inject.Named; 25 | import javax.inject.Singleton; 26 | 27 | /** 28 | * Maven module. 29 | * 30 | * @since 3.0 31 | */ 32 | @Named 33 | public class MavenModule 34 | implements Module 35 | { 36 | @Override 37 | public void configure(final Binder binder) { 38 | // empty 39 | } 40 | 41 | /** 42 | * Prepare the {@link ClassWorld} instance required by Maven. 43 | */ 44 | @Provides 45 | @Singleton 46 | public ClassWorld provideClassWorld() { 47 | return new ClassWorld("plexus.core", Thread.currentThread().getContextClassLoader()); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /mvnsh-commands/src/main/java/com/planet57/maven/shell/commands/maven/MavenOptionCompleter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-present the original author or authors. 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * and Apache License v2.0 which accompanies this distribution. 7 | * 8 | * The Eclipse Public License is available at 9 | * http://www.eclipse.org/legal/epl-v10.html 10 | * 11 | * The Apache License v2.0 is available at 12 | * http://www.apache.org/licenses/LICENSE-2.0.html 13 | * 14 | * You may elect to redistribute this code under either of these licenses. 15 | */ 16 | 17 | package com.planet57.maven.shell.commands.maven; 18 | 19 | import java.util.List; 20 | import java.util.concurrent.atomic.AtomicReference; 21 | 22 | import javax.inject.Named; 23 | import javax.inject.Singleton; 24 | 25 | import org.apache.commons.cli.Option; 26 | import org.apache.commons.cli.Options; 27 | import org.apache.maven.cli.CLIManager; 28 | import org.jline.reader.Candidate; 29 | import org.jline.reader.Completer; 30 | import org.jline.reader.LineReader; 31 | import org.jline.reader.ParsedLine; 32 | 33 | import com.planet57.gshell.util.jline.StringsCompleter2; 34 | 35 | import static com.google.common.base.Preconditions.checkState; 36 | 37 | /** 38 | * Maven option completer. 39 | * 40 | * @since 3.0 41 | */ 42 | @Named("maven-option") 43 | @Singleton 44 | public class MavenOptionCompleter 45 | implements Completer 46 | { 47 | private final StringsCompleter2 delegate = new StringsCompleter2(); 48 | 49 | public MavenOptionCompleter() { 50 | mavenOptions().forEach(option -> { 51 | if (option.hasArg() || option.hasArgs() || option.hasOptionalArg()) { 52 | // TODO: adjust for options with arguments; for now omit 53 | } 54 | else { 55 | delegate.add("-" + option.getOpt()); 56 | delegate.add("--" + option.getLongOpt()); 57 | } 58 | }); 59 | } 60 | 61 | /** 62 | * Extract {@code mvn} options from {@link CLIManager}. 63 | */ 64 | private static Iterable