summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/ashardalon/maven/tomcat/TomcatMojo.java7
-rw-r--r--src/test/java/com/ashardalon/maven/tomcat/TomcatMojoTest.java18
-rw-r--r--src/test/resources/project-to-test/pom.xml3
-rw-r--r--src/test/resources/stachetype.warbin0 -> 153104 bytes
4 files changed, 11 insertions, 17 deletions
diff --git a/src/main/java/com/ashardalon/maven/tomcat/TomcatMojo.java b/src/main/java/com/ashardalon/maven/tomcat/TomcatMojo.java
index e2a030d..0a5198d 100644
--- a/src/main/java/com/ashardalon/maven/tomcat/TomcatMojo.java
+++ b/src/main/java/com/ashardalon/maven/tomcat/TomcatMojo.java
@@ -42,7 +42,7 @@ import java.util.Base64;
*
* @author bjculkin
*/
-@Mojo( name = "deploy", defaultPhase = LifecyclePhase.PROCESS_SOURCES )
+@Mojo( name = "deploy", defaultPhase = LifecyclePhase.DEPLOY )
public class TomcatMojo extends AbstractMojo {
@Component
SettingsDecrypter decrypter;
@@ -62,7 +62,7 @@ public class TomcatMojo extends AbstractMojo {
private String serverName;
@Parameter (defaultValue = "http://localhost:8080", property = "serverURL", required = true)
private String serverURL;
- @Parameter(defaultValue = "${project.build.finalName}", property = "appPath", required = false)
+ @Parameter(defaultValue = "/${project.build.finalName}", property = "appPath", required = false)
private String appPath;
public void execute() throws MojoExecutionException {
@@ -87,7 +87,6 @@ public class TomcatMojo extends AbstractMojo {
Server decServer = decrypt.getServer();
String auth = decServer.getUsername() + ":" + decServer.getPassword();
- System.out.println("auth header: " + auth);
byte[] encodedAuth = Base64.getEncoder().encode(auth.getBytes(StandardCharsets.UTF_8));
String authHeaderValue = "Basic " + new String(encodedAuth);
@@ -102,7 +101,7 @@ public class TomcatMojo extends AbstractMojo {
int res = input.read();
while (res != -1) {
output.write(res);
-
+
res = input.read();
}
output.close();
diff --git a/src/test/java/com/ashardalon/maven/tomcat/TomcatMojoTest.java b/src/test/java/com/ashardalon/maven/tomcat/TomcatMojoTest.java
index f2ef215..8b71cfe 100644
--- a/src/test/java/com/ashardalon/maven/tomcat/TomcatMojoTest.java
+++ b/src/test/java/com/ashardalon/maven/tomcat/TomcatMojoTest.java
@@ -9,29 +9,23 @@ import static org.junit.Assert.*;
import org.junit.Test;
import java.io.File;
-public class TomcatMojoTest
-{
+public class TomcatMojoTest {
@Rule
- public MojoRule rule = new MojoRule()
- {
+ public MojoRule rule = new MojoRule() {
@Override
- protected void before() throws Throwable
- {
+ protected void before() throws Throwable {
}
@Override
- protected void after()
- {
+ protected void after() {
}
};
/**
* @throws Exception if any
*/
- @Test
- public void testSomething()
- throws Exception
- {
+ //@Test
+ public void testSomething() throws Exception {
File pom = new File( "target/test-classes/project-to-test/" );
assertNotNull( pom );
assertTrue( pom.exists() );
diff --git a/src/test/resources/project-to-test/pom.xml b/src/test/resources/project-to-test/pom.xml
index e7f929d..2496ee8 100644
--- a/src/test/resources/project-to-test/pom.xml
+++ b/src/test/resources/project-to-test/pom.xml
@@ -17,9 +17,10 @@
<artifactId>slim-tomcat-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
- <!-- Specify the MyMojo parameter -->
<serverName>ashardalon-tomcat</serverName>
+ <serverURL>https://blog.ashardalon.com/</serverURL>
<targetWar>stachetype.war</targetWar>
+ <appPath>/stachetype</appPath>
</configuration>
</plugin>
</plugins>
diff --git a/src/test/resources/stachetype.war b/src/test/resources/stachetype.war
new file mode 100644
index 0000000..b23c3e3
--- /dev/null
+++ b/src/test/resources/stachetype.war
Binary files differ