Sam Adams avatar Sam Adams committed 82c67fe

separated standalone project

Comments (0)

Files changed (5)

             </build>
         </profile>
 
-        <profile>
-            <id>standalone</id>
-
-            <build>
-                <plugins>
-
-                    <plugin>
-                        <artifactId>maven-compiler-plugin</artifactId>
-                        <configuration>
-                            <includes>
-                                <include>src/main/java</include>
-                                <include>src/main/java-standalone</include>
-                            </includes>
-                        </configuration>
-                    </plugin>
-
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-shade-plugin</artifactId>
-                        <version>1.4</version>
-                        <executions>
-                            <execution>
-                                <phase>package</phase>
-                                <goals>
-                                    <goal>shade</goal>
-                                </goals>
-                                <configuration>
-                                    <shadedArtifactAttached>false</shadedArtifactAttached>
-                                    <createDependencyReducedPom>true</createDependencyReducedPom>
-                                    <transformers>
-                                        <transformer
-                                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                                            <mainClass>EmbeddedJettyServer</mainClass>
-                                        </transformer>
-                                    </transformers>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-
-                    <!-- The main class needs to be in the root of the war in order to be runnable -->
-                    <plugin>
-                        <artifactId>maven-antrun-plugin</artifactId>
-                        <executions>
-                            <execution>
-                                <id>move-main-class</id>
-                                <phase>compile</phase>
-                                <configuration>
-                                    <tasks>
-                                        <move todir="${project.build.directory}/${project.artifactId}-${project.version}">
-                                            <fileset dir="${project.build.directory}/classes/">
-                                                <include name="EmbeddedJettyServer.class"/>
-                                            </fileset>
-                                        </move>
-                                    </tasks>
-                                </configuration>
-                                <goals>
-                                    <goal>run</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                    </plugin>
-
-                    <plugin>
-                        <artifactId>maven-assembly-plugin</artifactId>
-                        <configuration>
-                            <descriptors>
-                                <descriptor>src/main/assembly/bin-dist.xml</descriptor>
-                            </descriptors>
-                            <appendAssemblyId>false</appendAssemblyId>
-                            <attach>false</attach>
-                        </configuration>
-                        <executions>
-                            <execution>
-                                <goals>
-                                    <goal>single</goal>
-                                </goals>
-                                <phase>package</phase>
-                            </execution>
-                        </executions>
-                    </plugin>
-
-                </plugins>
-            </build>
-
-            <dependencies>
-                <dependency>
-                    <groupId>org.mortbay.jetty</groupId>
-                    <artifactId>jetty</artifactId>
-                    <version>6.1.26</version>
-                </dependency>
-            </dependencies>
-
-        </profile>
-
     </profiles>
 
 </project>

src/main/assembly/bin-dist.xml

-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-
-    <id>bin-dist</id>
-
-    <formats>
-        <format>tar.gz</format>
-        <format>zip</format>
-    </formats>
-
-    <baseDirectory>quixote-repository-${project.version}</baseDirectory>
-
-    <files>
-        <file>
-            <source>src/main/bin/run.bat</source>
-            <outputDirectory>/</outputDirectory>
-            <filtered>true</filtered>
-            <lineEnding>dos</lineEnding>
-        </file>
-        <file>
-            <source>src/main/bin/run.sh</source>
-            <outputDirectory>/</outputDirectory>
-            <filtered>true</filtered>
-            <lineEnding>unix</lineEnding>
-            <fileMode>0755</fileMode>
-        </file>
-        <file>
-            <source>target/quixote-webapp-0.1-SNAPSHOT.war</source>
-            <outputDirectory>/</outputDirectory>
-            <destName>quixote-webapp-standalone-0.1-SNAPSHOT.war</destName>
-        </file>
-    </files>
-
-    <fileSets>
-        <fileSet>
-            <includes>
-                <include>README*</include>
-                <include>LICENSE*</include>
-                <include>NOTICE*</include>
-            </includes>
-        </fileSet>
-    </fileSets>
-
-</assembly>

src/main/bin/run.bat

-java -jar quixote-webapp-standalone-${project.version}.war

src/main/bin/run.sh

-#!/bin/sh
-
-java -jar quixote-webapp-standalone-${project.version}.war

src/main/java-standalone/EmbeddedJettyServer.java

-/*
- * Copyright 2012 Sam Adams
- *
- * Licensed 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.
- */
-
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.webapp.WebAppContext;
-
-import java.net.URI;
-import java.net.URL;
-import java.security.ProtectionDomain;
-
-/**
- * @author Sam Adams
- */
-public class EmbeddedJettyServer {
-
-    private final WebAppContext webAppContext;
-    private int port;
-
-    private EmbeddedJettyServer() {
-        webAppContext = createWebAppContext();
-    }
-
-    private WebAppContext createWebAppContext() {
-        final ProtectionDomain domain = EmbeddedJettyServer.class.getProtectionDomain();
-        final URL location = domain.getCodeSource().getLocation();
-
-        final WebAppContext webapp = new WebAppContext();
-        webapp.setContextPath("/");
-        webapp.setDescriptor(location.toExternalForm() + "/WEB-INF/web.xml");
-        webapp.setWar(location.toExternalForm());
-
-        return webapp;
-    }
-
-    private void run() throws Exception {
-        checkConfiguration();
-
-        final Server server = new Server(port);
-        server.setHandler(webAppContext);
-
-        server.start();
-        server.join();
-    }
-
-    private void checkConfiguration() {
-        checkWorkspace();
-        checkUri();
-    }
-
-    private void checkWorkspace() {
-        if (System.getProperty("chempound.workspace") == null) {
-            webAppContext.setAttribute("chempound.workspace", "./quixote-workspace/");
-        }
-    }
-
-    private void checkUri() {
-        String uri = System.getProperty("chempound.uri");
-        if (uri == null) {
-            webAppContext.setAttribute("chempound.uri", "http://localhost:8080/");
-            port = 8080;
-        } else {
-            URI u = URI.create(uri);
-            port = u.getPort() == -1 ? 80 : u.getPort();
-        }
-    }
-
-    public static void main(String[] args) throws Exception {
-        final EmbeddedJettyServer server = new EmbeddedJettyServer();
-        server.run();
-    }
-
-}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.