001/*
002 * Copyright 2012-2017 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.cli.command.archive;
018
019import java.io.File;
020
021import org.springframework.boot.cli.command.Command;
022import org.springframework.boot.loader.tools.Layouts;
023import org.springframework.boot.loader.tools.LibraryScope;
024
025/**
026 * {@link Command} to create a self-contained executable jar file from a CLI application.
027 *
028 * @author Andy Wilkinson
029 * @author Phillip Webb
030 */
031public class JarCommand extends ArchiveCommand {
032
033        public JarCommand() {
034                super("jar", "Create a self-contained executable jar "
035                                + "file from a Spring Groovy script", new JarOptionHandler());
036        }
037
038        private static final class JarOptionHandler extends ArchiveOptionHandler {
039
040                JarOptionHandler() {
041                        super("jar", new Layouts.Jar());
042                }
043
044                @Override
045                protected LibraryScope getLibraryScope(File file) {
046                        return LibraryScope.COMPILE;
047                }
048
049        }
050
051}