Updating CLI distribution to have bin, lib, conf and logs folders
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7e6aaf1f Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7e6aaf1f Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7e6aaf1f Branch: refs/heads/master Commit: 7e6aaf1fd46afcc9f16d510c76b9af322720e1f2 Parents: dce73b0 Author: Imesh Gunaratne <[email protected]> Authored: Wed Dec 17 11:49:44 2014 +0530 Committer: Udara Liyanage <[email protected]> Committed: Thu Dec 18 12:06:58 2014 +0530 ---------------------------------------------------------------------- products/stratos-cli/distribution/pom.xml | 34 +++++++++++++- .../distribution/src/main/assembly/bin.xml | 49 +++++++++++++------- .../distribution/src/main/bin/stratos.bat | 2 +- .../distribution/src/main/bin/stratos.sh | 13 ++++-- .../distribution/src/main/conf/log4j.properties | 37 +++++++++++++++ 5 files changed, 112 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/7e6aaf1f/products/stratos-cli/distribution/pom.xml ---------------------------------------------------------------------- diff --git a/products/stratos-cli/distribution/pom.xml b/products/stratos-cli/distribution/pom.xml index ae5ce40..137a48c 100644 --- a/products/stratos-cli/distribution/pom.xml +++ b/products/stratos-cli/distribution/pom.xml @@ -32,6 +32,27 @@ <url>http://apache.org/</url> <description>Apache Stratos CLI Distribution</description> + <repositories> + <repository> + <id>wso2-nexus</id> + <name>WSO2 internal Repository</name> + <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url> + <releases> + <enabled>true</enabled> + <updatePolicy>daily</updatePolicy> + <checksumPolicy>ignore</checksumPolicy> + </releases> + </repository> + </repositories> + + <dependencies> + <dependency> + <groupId>org.apache.stratos</groupId> + <artifactId>org.apache.stratos.cli</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + <profiles> <profile> <id>default</id> @@ -43,6 +64,18 @@ <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.4</version> + <configuration> + <archive> + <manifest> + <mainClass>org.apache.stratos.cli.Main</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> @@ -64,5 +97,4 @@ </build> </profile> </profiles> - </project> http://git-wip-us.apache.org/repos/asf/stratos/blob/7e6aaf1f/products/stratos-cli/distribution/src/main/assembly/bin.xml ---------------------------------------------------------------------- diff --git a/products/stratos-cli/distribution/src/main/assembly/bin.xml b/products/stratos-cli/distribution/src/main/assembly/bin.xml index 3998ff3..a97afa5 100644 --- a/products/stratos-cli/distribution/src/main/assembly/bin.xml +++ b/products/stratos-cli/distribution/src/main/assembly/bin.xml @@ -22,34 +22,33 @@ <formats> <format>zip</format> </formats> - <includeBaseDirectory>false</includeBaseDirectory> - <fileSets> <fileSet> - <directory>../../../components/org.apache.stratos.cli/target</directory> - <outputDirectory>${pom.artifactId}-${pom.version}</outputDirectory> + <directory>${project.basedir}/src/main/bin</directory> + <outputDirectory>/bin</outputDirectory> <includes> - <include>org.apache.stratos.cli-${pom.version}.jar</include> + <include>stratos.sh</include> </includes> + <fileMode>0755</fileMode> </fileSet> <fileSet> - <directory>src/main/bin</directory> - <outputDirectory>${pom.artifactId}-${pom.version}</outputDirectory> + <directory>${project.basedir}/src/main/bin</directory> + <outputDirectory>/bin</outputDirectory> <includes> - <include>stratos.sh</include> + <include>stratos.bat</include> </includes> - <fileMode>0755</fileMode> </fileSet> <fileSet> - <directory>src/main/bin</directory> - <outputDirectory>${pom.artifactId}-${pom.version}</outputDirectory> + <directory>${project.basedir}/src/main/conf</directory> + <outputDirectory>/conf</outputDirectory> <includes> - <include>stratos.bat</include> + <include>log4j.properties</include> </includes> + <fileMode>0600</fileMode> </fileSet> <fileSet> <directory>${project.basedir}</directory> - <outputDirectory>${pom.artifactId}-${pom.version}</outputDirectory> + <outputDirectory>/</outputDirectory> <includes> <include>INSTALL.txt</include> <include>README.txt</include> @@ -58,16 +57,32 @@ </fileSets> <files> <file> - <source>src/main/notice/NOTICE</source> - <outputDirectory>${pom.artifactId}-${pom.version}</outputDirectory> + <source>${project.basedir}/src/main/notice/NOTICE</source> + <outputDirectory>/</outputDirectory> <filtered>true</filtered> <fileMode>644</fileMode> </file> <file> - <source>src/main/license/LICENSE</source> - <outputDirectory>${pom.artifactId}-${pom.version}</outputDirectory> + <source>${project.basedir}/src/main/license/LICENSE</source> + <outputDirectory>/</outputDirectory> <filtered>true</filtered> <fileMode>644</fileMode> </file> </files> + <dependencySets> + <dependencySet> + <excludes> + <exclude>*:annotations*</exclude> + <exclude>*:icu4j*</exclude> + <exclude>*:jaxen*</exclude> + <exclude>*:jboss-transaction-api*</exclude> + <exclude>*:wrapper*</exclude> + <exclude>*:xom*</exclude> + <exclude>slf4j.wso2:slf4j</exclude> + </excludes> + <outputDirectory>/lib</outputDirectory> + <useProjectArtifact>true</useProjectArtifact> + <scope>runtime</scope> + </dependencySet> + </dependencySets> </assembly> http://git-wip-us.apache.org/repos/asf/stratos/blob/7e6aaf1f/products/stratos-cli/distribution/src/main/bin/stratos.bat ---------------------------------------------------------------------- diff --git a/products/stratos-cli/distribution/src/main/bin/stratos.bat b/products/stratos-cli/distribution/src/main/bin/stratos.bat index d610d50..ed3c4f5 100644 --- a/products/stratos-cli/distribution/src/main/bin/stratos.bat +++ b/products/stratos-cli/distribution/src/main/bin/stratos.bat @@ -32,5 +32,5 @@ if "%STRATOS_CLI_HOME%"=="" set STRATOS_CLI_HOME=%CD% cd %STRATOS_CLI_HOME% -java -jar "org.apache.stratos.cli-4.0.0-SNAPSHOT.jar" %* +rem TODO: Update according to stratos.sh http://git-wip-us.apache.org/repos/asf/stratos/blob/7e6aaf1f/products/stratos-cli/distribution/src/main/bin/stratos.sh ---------------------------------------------------------------------- diff --git a/products/stratos-cli/distribution/src/main/bin/stratos.sh b/products/stratos-cli/distribution/src/main/bin/stratos.sh index b4b99b4..c1dda20 100755 --- a/products/stratos-cli/distribution/src/main/bin/stratos.sh +++ b/products/stratos-cli/distribution/src/main/bin/stratos.sh @@ -25,11 +25,16 @@ # # STRATOS_URL The URL of the Stratos Controller -if [ -z $STRATOS_CLI_HOME ] ; then -STRATOS_CLI_HOME="$PWD" +echo "Starting Stratos CLI..." +if [ -z "$STRATOS_URL" ]; then + echo "STRATOS_URL environment variable is not set" fi -#debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" +script_path="$( cd -P "$( dirname "$SOURCE" )" && pwd )/`dirname $0`" +lib_path=${script_path}/../lib/ +class_path=`echo ${lib_path}/*.jar | tr ' ' ':'` -java -jar ${debug} $STRATOS_CLI_HOME/org.apache.stratos.cli-4.1.0-SNAPSHOT.jar $* +properties="-Dlog4j.configuration=file://${script_path}/../conf/log4j.properties" +#debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" +java -cp "${class_path}" ${properties} ${debug} org.apache.stratos.cli.Main http://git-wip-us.apache.org/repos/asf/stratos/blob/7e6aaf1f/products/stratos-cli/distribution/src/main/conf/log4j.properties ---------------------------------------------------------------------- diff --git a/products/stratos-cli/distribution/src/main/conf/log4j.properties b/products/stratos-cli/distribution/src/main/conf/log4j.properties new file mode 100644 index 0000000..ec18740 --- /dev/null +++ b/products/stratos-cli/distribution/src/main/conf/log4j.properties @@ -0,0 +1,37 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Set root logger level and appenders +log4j.rootLogger=INFO, FILE_APPENDER + +# CONSOLE_APPENDER is set to be a ConsoleAppender. +#log4j.appender.CONSOLE_APPENDER=org.apache.log4j.ConsoleAppender + +# The standard error log where all the warnings, errors and fatal errors will be logged +log4j.appender.FILE_APPENDER=org.apache.log4j.FileAppender +log4j.appender.FILE_APPENDER.File=logs/stratos-cli.log +log4j.appender.FILE_APPENDER.layout=org.apache.log4j.PatternLayout +log4j.appender.FILE_APPENDER.layout.ConversionPattern=%d{ISO8601} [%X{ip}-%X{host}] [%t] %5p %c{1} %m%n +log4j.appender.FILE_APPENDER.threshold=DEBUG + +# CONSOLE_APPENDER uses PatternLayout. +log4j.appender.CONSOLE_APPENDER.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE_APPENDER.layout.ConversionPattern=[%d{ISO8601}] %5p - [%c{1}] %m%n + +log4j.logger.org.apache.stratos.cli=INFO
