Skip to content

Instantly share code, notes, and snippets.

@dzlab
Last active April 14, 2016 14:46

Revisions

  1. dzlab renamed this gist Apr 14, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. dzlab created this gist Feb 5, 2016.
    60 changes: 60 additions & 0 deletions commands.mvn
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    # maven ignoring license
    mvn install -Dlicense.skip=true -DskipTests
    # maven fat jar
    mvn assembly:assembly -DdescriptorId=jar-with-dependencies -DskipTests
    # maven generate webapp project
    mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp
    # maven generate empty project
    mvn archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart
    mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

    # maven run tests of a given class
    mvn test -Dtest=classname


    Maven plugins:
    == Tomcat
    ```xml
    <build>
    <plugins>
    <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.1</version>
    <configuration>
    <path>/</path>
    </configuration>
    </plugin>
    </plugins>
    </build>
    ```
    mvn clean install tomcat7:run
    == Executable jar with dependencies:
    ```xml
    <build>
    <plugins>
    <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
    <archive>
    <manifest>
    <mainClass>[app.package.ClassName]</mainClass>
    </manifest>
    </archive>
    <descriptorRefs>
    <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
    </configuration>
    <executions>
    <execution>
    <id>make-assembly</id> <!-- this is used for inheritance merges -->
    <phase>package</phase> <!-- bind to the packaging phase -->
    <goals>
    <goal>single</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    </plugins>
    </build>
    ```