├── mvnsh-assembly
├── src
│ └── main
│ │ ├── resources
│ │ ├── etc
│ │ │ ├── mvnsh.profile
│ │ │ └── logback.xml
│ │ ├── README.txt
│ │ ├── examples
│ │ │ └── mvnsh.rc
│ │ ├── bin
│ │ │ ├── mvnsh
│ │ │ ├── mvnx
│ │ │ ├── mvnsh.bat
│ │ │ └── mvnx.bat
│ │ └── LICENSE.txt
│ │ └── assembly
│ │ └── bin.xml
└── pom.xml
├── src
└── art
│ ├── logo.png
│ ├── logo.psd
│ ├── shell1.psd
│ └── logo-48x48.png
├── .gitignore
├── .mvn
└── wrapper
│ ├── maven-wrapper.jar
│ └── maven-wrapper.properties
├── .travis
└── settings.xml
├── .travis.yml
├── mvnsh-commands
├── src
│ ├── test
│ │ ├── resources
│ │ │ └── com
│ │ │ │ └── planet57
│ │ │ │ └── maven
│ │ │ │ └── shell
│ │ │ │ └── commands
│ │ │ │ └── maven
│ │ │ │ ├── test1.pom
│ │ │ │ └── settings.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── planet57
│ │ │ └── maven
│ │ │ └── shell
│ │ │ └── commands
│ │ │ └── maven
│ │ │ ├── EncryptPasswordActionTest.groovy
│ │ │ └── MavenActionTest.groovy
│ └── main
│ │ ├── java
│ │ ├── com
│ │ │ └── planet57
│ │ │ │ └── maven
│ │ │ │ └── shell
│ │ │ │ └── commands
│ │ │ │ └── maven
│ │ │ │ ├── package-info.java
│ │ │ │ ├── MavenModule.java
│ │ │ │ ├── MavenCompleter.java
│ │ │ │ ├── MavenPhaseCompleter.java
│ │ │ │ ├── MavenOptionCompleter.java
│ │ │ │ ├── MavenPluginGoalCompleter.java
│ │ │ │ ├── MavenAction.java
│ │ │ │ └── EncryptPasswordAction.java
│ │ └── org
│ │ │ └── apache
│ │ │ └── maven
│ │ │ └── cli
│ │ │ └── CliRequestBuilder.java
│ │ └── resources
│ │ └── com
│ │ └── planet57
│ │ └── maven
│ │ └── shell
│ │ └── commands
│ │ └── maven
│ │ ├── EncryptPasswordAction.help
│ │ └── MavenAction.help
└── pom.xml
├── header.txt
├── mvnsh-personality
├── src
│ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── planet57
│ │ │ └── maven
│ │ │ └── shell
│ │ │ ├── package-info.java
│ │ │ ├── BrandingImpl.java
│ │ │ └── Main.java
│ │ └── resources
│ │ └── com
│ │ └── planet57
│ │ └── maven
│ │ └── shell
│ │ └── license.txt
└── pom.xml
├── mvnsh-bootstrap
├── src
│ └── main
│ │ └── filtered-resources
│ │ └── bootstrap.properties
└── pom.xml
├── README.md
├── mvnw.cmd
├── mvnw
├── pom.xml
└── LICENSE.txt
/mvnsh-assembly/src/main/resources/etc/mvnsh.profile:
--------------------------------------------------------------------------------
1 | alias dir ls
2 |
--------------------------------------------------------------------------------
/src/art/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jdillon/mvnsh/HEAD/src/art/logo.png
--------------------------------------------------------------------------------
/src/art/logo.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jdillon/mvnsh/HEAD/src/art/logo.psd
--------------------------------------------------------------------------------
/src/art/shell1.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jdillon/mvnsh/HEAD/src/art/shell1.psd
--------------------------------------------------------------------------------
/src/art/logo-48x48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jdillon/mvnsh/HEAD/src/art/logo-48x48.png
--------------------------------------------------------------------------------
/.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/HEAD/.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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/.travis/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ossrh
6 | jdillon
7 | ${env.SONATYPE_PASSWORD}
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/mvnsh-commands/src/test/resources/com/planet57/maven/shell/commands/maven/test1.pom:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 | 4.0.0
7 |
8 | org.apache.maven.shell.test
9 | test1
10 | 1-SNAPSHOT
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/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-personality/src/main/java/com/planet57/maven/shell/package-info.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 | * Maven shell.
18 | *
19 | * @since 0.7
20 | */
21 | package com.planet57.maven.shell;
22 |
--------------------------------------------------------------------------------
/mvnsh-commands/src/main/java/com/planet57/maven/shell/commands/maven/package-info.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 | * Maven commands.
18 | *
19 | * @since 0.7
20 | */
21 | package com.planet57.maven.shell.commands.maven;
22 |
--------------------------------------------------------------------------------
/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-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-commands/src/main/resources/com/planet57/maven/shell/commands/maven/EncryptPasswordAction.help:
--------------------------------------------------------------------------------
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 | @|bold NAME|@
18 |
19 | @{command.name} - @{command.description}
20 |
21 | @|bold SYNOPSIS|@
22 |
23 | @|bold @{command.name}|@ [options] PASSWORD
24 |
25 | @|bold DESCRIPTION|@
26 |
27 | Encrypt passwords. This command replaces @|bold mvn --encrypt-master-password|@
28 | and @|bold mvn --encrypt-password|@.
29 |
30 | @{command.details}
31 |
32 | @|bold EXAMPLES|@
33 |
34 | Encrypt a password:
35 |
36 | @{command.name} PASSWORD
37 |
38 | Encrypt a master password:
39 |
40 | @{command.name} -m PASSWORD
41 |
42 | @|bold SEE ALSO|@
43 |
44 | @|bold mvn|@
45 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
18 | # Description
19 |
20 | Maven Shell (`mvnsh`)
21 |
22 | [](https://travis-ci.org/jdillon/mvnsh)
23 | [](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 |
--------------------------------------------------------------------------------
/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/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-commands/src/main/resources/com/planet57/maven/shell/commands/maven/MavenAction.help:
--------------------------------------------------------------------------------
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 | @|bold NAME|@
18 |
19 | @{command.name} - @{command.description}
20 |
21 | @|bold SYNOPSIS|@
22 |
23 | @|bold @{command.name}|@ [options] [goal...] [phase...]
24 |
25 | @|bold DESCRIPTION|@
26 |
27 | Provides a fast embedded execution of Maven.
28 |
29 | @{command.details}
30 |
31 | @|bold EXAMPLES|@
32 |
33 | Execute the default goal on the default pom.xml:
34 |
35 | @{command.name}
36 |
37 | Execute specific goals:
38 |
39 | @{command.name} clean install
40 |
41 | Execute a specific project:
42 |
43 | @{command.name} -f project/pom.xml
44 |
45 | @|bold SEE ALSO|@
46 |
47 | @|bold encrypt-password|@, @|bold pref/set|@
48 |
49 | @|bold TIPS|@
50 |
51 | Define an alias for @|bold mvn|@ and include common options or arguments:
52 |
53 | alias build @{command.name} -o
54 |
55 | Running @|bold build|@ will now run Maven offline.
56 |
57 | alias build @{command.name} -o -Dmaven.test.skip
58 |
59 | Running @|bold build|@ will now run Maven offline and skip tests.
60 |
--------------------------------------------------------------------------------
/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.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-commands/src/test/java/com/planet57/maven/shell/commands/maven/EncryptPasswordActionTest.groovy:
--------------------------------------------------------------------------------
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.junit.Test
19 |
20 | import com.planet57.gshell.testharness.CommandTestSupport
21 | import org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher
22 |
23 | /**
24 | * Tests for {@link EncryptPasswordAction}.
25 | */
26 | class EncryptPasswordActionTest
27 | extends CommandTestSupport
28 | {
29 | EncryptPasswordActionTest() {
30 | super(EncryptPasswordAction.class)
31 | }
32 |
33 | // TODO: verify; result is not the value due to compat with maven core-its
34 |
35 | @Test
36 | void 'encrypt master password'() {
37 | assert executeCommand('--master', 'changeme') == null
38 | }
39 |
40 | @Test
41 | void 'encrypt password'() {
42 | // setup security configuration file required to encrypt
43 | File configFile = util.createTempFile('settings-security.xml')
44 | configFile.text = '{ZMqZbaOUj68HIixUY8QipRT6ZCsXviNpcP3X7QvXEDc=}' // changeme
45 | System.setProperty(DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION, configFile.absolutePath)
46 |
47 | assert executeCommand('foo') == null
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/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/test/java/com/planet57/maven/shell/commands/maven/MavenActionTest.groovy:
--------------------------------------------------------------------------------
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 com.planet57.gshell.testharness.CommandTestSupport
19 | import org.junit.Test
20 |
21 | /**
22 | * Tests for {@link MavenAction}.
23 | */
24 | class MavenActionTest
25 | extends CommandTestSupport
26 | {
27 | MavenActionTest() {
28 | super(MavenAction.class)
29 | }
30 |
31 | @Test
32 | void 'mvn package'() {
33 | File settings = new File(getClass().getResource('settings.xml').toURI())
34 | println("Settings: $settings")
35 |
36 | File pom = new File(getClass().getResource('test1.pom').toURI())
37 | println("POM: $pom")
38 |
39 | //File repoDir = new File(new File(System.getProperty('basedir')), 'target/test-repo')
40 | //println("Repo Dir: $repoDir")
41 |
42 | Object result = executeCommand(
43 | '-B', '-e', '-V',
44 | '-f', pom.absolutePath,
45 | '-s', settings.absolutePath,
46 | // "-Dmaven.repo.local=$repoDir",
47 | 'package')
48 |
49 | println("OUT: ${io.outputString}")
50 | println("ERR: ${io.errorString}")
51 |
52 | assert result == 0
53 | }
54 |
55 | /**
56 | * Customized help test as this isn't using the default help support by gshell.
57 | */
58 | @Override
59 | @Test
60 | void testHelp() {
61 | assert executeCommand('--help') == 0
62 | assert executeCommand('-h') == 0
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/mvnsh-personality/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-personality
31 | ${project.groupId}:${project.artifactId}
32 |
33 |
34 |
35 | com.planet57.gshell
36 | gshell-core
37 |
38 |
39 |
40 | com.google.inject
41 | guice
42 | provided
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | com.planet57.gshell.ext
52 | gshell-logback
53 |
54 |
55 |
56 | com.planet57.gshell.ext
57 | gshell-plexus
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/mvnsh-commands/src/main/java/org/apache/maven/cli/CliRequestBuilder.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 org.apache.maven.cli;
17 |
18 | import java.io.File;
19 | import java.util.List;
20 |
21 | import static com.google.common.base.Preconditions.checkState;
22 |
23 | /**
24 | * Helper to create {@link CliRequest} instances.
25 | *
26 | * This is needed to configure package-private options needed to setup the environment for Maven execution.
27 | *
28 | * @since 1.2
29 | */
30 | public class CliRequestBuilder
31 | {
32 | private List arguments;
33 |
34 | private File workingDirectory;
35 |
36 | private File projectDirectory;
37 |
38 | public List getArguments() {
39 | return arguments;
40 | }
41 |
42 | public void setArguments(final List arguments) {
43 | this.arguments = arguments;
44 | }
45 |
46 | public File getWorkingDirectory() {
47 | return workingDirectory;
48 | }
49 |
50 | public void setWorkingDirectory(final File workingDirectory) {
51 | this.workingDirectory = workingDirectory;
52 | }
53 |
54 | public File getProjectDirectory() {
55 | return projectDirectory;
56 | }
57 |
58 | public void setProjectDirectory(final File projectDirectory) {
59 | this.projectDirectory = projectDirectory;
60 | }
61 |
62 | public CliRequest build() {
63 | checkState(arguments != null, "Missing: arguments");
64 |
65 | CliRequest request = new CliRequest(arguments.toArray(new String[arguments.size()]), null);
66 | request.workingDirectory = workingDirectory.getAbsolutePath();
67 | request.multiModuleProjectDirectory = projectDirectory;
68 |
69 | return request;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/mvnsh-commands/src/main/java/com/planet57/maven/shell/commands/maven/MavenPhaseCompleter.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.planet57.gshell.plexus.PlexusRuntime;
20 | import com.planet57.gshell.util.jline.StringsCompleter2;
21 | import org.apache.maven.lifecycle.Lifecycle;
22 | import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
23 | import org.jline.reader.Candidate;
24 | import org.jline.reader.Completer;
25 | import org.jline.reader.LineReader;
26 | import org.jline.reader.ParsedLine;
27 | import org.sonatype.goodies.common.ComponentSupport;
28 |
29 | import javax.inject.Inject;
30 | import javax.inject.Named;
31 | import javax.inject.Singleton;
32 | import java.util.List;
33 |
34 | import static com.google.common.base.Preconditions.checkNotNull;
35 |
36 | /**
37 | * Maven lifecycle phase completer.
38 | *
39 | * @since 3.0
40 | */
41 | @Named("maven-phase")
42 | @Singleton
43 | public class MavenPhaseCompleter
44 | extends ComponentSupport
45 | implements Completer
46 | {
47 | private final StringsCompleter2 delegate = new StringsCompleter2();
48 |
49 | @Inject
50 | public MavenPhaseCompleter(final PlexusRuntime plexus) {
51 | checkNotNull(plexus);
52 |
53 | try {
54 | addPhases(plexus, "default");
55 | addPhases(plexus, "clean");
56 | addPhases(plexus, "site");
57 | }
58 | catch (ComponentLookupException e) {
59 | throw new RuntimeException(e);
60 | }
61 | }
62 |
63 | private void addPhases(final PlexusRuntime plexus, final String roleHint) throws ComponentLookupException {
64 | Lifecycle lifecycle = plexus.lookup(Lifecycle.class, roleHint);
65 | log.debug("Adding phases for lifecycle: {}", lifecycle);
66 | delegate.addAll(lifecycle.getPhases());
67 | }
68 |
69 | @Override
70 | public void complete(final LineReader reader, final ParsedLine line, final List candidates) {
71 | delegate.complete(reader, line, candidates);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/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