Skip to content

Commit

Permalink
Add Maven Exec plugin in order to show how to start application + LTW
Browse files Browse the repository at this point in the history
  • Loading branch information
kriegaex committed Jun 4, 2019
1 parent afbc634 commit 249f7a0
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
24 changes: 24 additions & 0 deletions application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<artifactId>application</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<main-class>de.scrum_master.app.CounterApp</main-class>
</properties>

<dependencies>
<dependency>
<groupId>de.scrum-master</groupId>
Expand All @@ -27,6 +31,10 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
</dependency>
</dependencies>

<build>
Expand All @@ -40,6 +48,22 @@
</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
<arguments>
<argument>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</argument>
<argument>-classpath</argument>
<!-- automatically creates the classpath using all project dependencies, also adding the project build directory -->
<classpath/>
<argument>${main-class}</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
15 changes: 15 additions & 0 deletions application/src/main/java/de/scrum_master/app/CounterApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package de.scrum_master.app;

import spark.Spark;

import static spark.Spark.get;

public class CounterApp {
public static void main(String[] args) {
get("/counter", (req, res) -> {
new MyCounter().count();
return "I ALREADY CALLED COUNTER ASPECT ON METHOD:MyCounter().count()";
});
System.out.println("Application starting on port :" + Spark.port());
}
}
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down Expand Up @@ -97,6 +102,11 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.9.0</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down

0 comments on commit 249f7a0

Please sign in to comment.