$ mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>>
[INFO]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# bin/compile <build-dir> <cache-dir> | |
# fail fast | |
set -e | |
BIN_DIR=$(cd $(dirname $0); pwd) # absolute path | |
# parse args | |
BUILD_DIR=$1 | |
CACHE_DIR=$2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# bin/compile <build-dir> <cache-dir> | |
# fail fast | |
set -e | |
BIN_DIR=$(cd $(dirname $0); pwd) # absolute path | |
# parse args | |
BUILD_DIR=$1 | |
CACHE_DIR=$2 |
If you're building a Java web app that you yourself or your organization will be deploying then you can save yourself a lot of trouble by avoiding the whole build-to-war + deploy-to-server approach. Instead, you should build your web app as a normal Java application with an embedded web app server. Don't build a WAR, just compile the code and serve the files out of their source location. This has the following advantages:
- You can code and test iteratively because you don't have to copy files and create war packages every time you make a change. This is similar to what the
mvn jetty:run
command is being used for by many developers today. - You run the same exact code in production as you do in development. Hopefully I don't have to elaborate on the advantages of that. Most developers today use
mvn jetty:run
or similar to achieve a quick, iterative dev cycle. But come time for deployment, they build a WAR and throw it over the wall to be deployed in some app server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.util.jar.JarFile jar = | |
new java.util.jar.JarFile((thispackage.ThisClass.class.getProtectionDomain() | |
.getCodeSource().getLocation()).getFile()); | |
System.out.println(jar.getManifest().getMainAttributes().getValue("Class-Path")); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mvn archetype:generate -DarchetypeCatalog=http://repo.t.salesforce.com/archiva/repository/releases/archetype-catalog.xml -DarchetypeGroupId=com.force.sdk -DarchetypeArtifactId=springmvc-archetype |
NewerOlder