When I run the build of my project, before running the tests, I need to download and unzip the chromedriver.
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<get src="https://chromedriver.storage.googleapis.com/2.26/chromedriver_win32.zip"
dest="${project.basedir}"
verbose="false"
usetimestamp="true" />
<unzip src="${project.basedir}/chromedriver_win32.zip" dest="${project.basedir}/drivers/" />
<delete file="${project.basedir}/chromedriver_win32.zip" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
To download I'm using the antrun plugin, but, even declaring the surefire plugin later in pom.xml, as I saw in other questions, to run the tests later too, the build did not download the driver before.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building identificationkey 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # identificationkey ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\malibu\workspace\identificationkey\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # identificationkey ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # identificationkey ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # identificationkey ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) # identificationkey ---
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Tests run: 4, Failures: 1, Errors: 0, Skipped: 3, Time elapsed: 1.32 sec <<< FAILURE! - in TestSuite
setUp(br.ufrn.imd.ihc.identificationkey.run.LoginTest) Time elapsed: 0.743 sec <<< FAILURE!
java.lang.IllegalStateException: The driver executable does not exist: C:\Users\malibu\workspace\identificationkey\drivers\chromedriver.exe
at br.ufrn.imd.ihc.identificationkey.run.LoginTest.setUp(LoginTest.java:25)
Results :
Failed tests:
LoginTest.setUp:25 ยป IllegalState The driver executable does not exist: C:\Use...
Tests run: 4, Failures: 1, Errors: 0, Skipped: 3
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.784 s
[INFO] Finished at: 2016-12-22T17:52:02-03:00
[INFO] Final Memory: 18M/244M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project identificationkey: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\malibu\workspace\identificationkey\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
What am I doing wrong? Any help would be appreciated.
You need to be aware of the Maven lifecycle (see Introduction to the Build Lifecycle), which dictates the order in which maven processes your build.
In your case, you have specified <phase>package</phase> for your maven-antrun-plugin execution, which comes after test.
I would use something like <phase>process-test-resources</phase> for your use case.
Related
I want to set main class in pom.xml to run exec:java I checked lots of resources but still have the same error.
I tried putting it in under execution tag.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.mertilovski.app.Game</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
My main class in under app directory.
TicTacToe/TicTacToe-Game/src/main/java/com/mertilovski/app
pom.xml is in TicTacToe directory.
That is where I run
mvn exec:java -Dexec.mainClass="com.mertilovski.app.Game"
I tried making an package com.mertilovski.app; declaration on top.
mvn exec:java -Dexec.mainClass="src.main.java.com.mertilovski.app.com.mertilovski.app.Game
"
Result is :
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------
------------
[INFO] Building TicTacToe-Game 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------
------------
[INFO]
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) > validate #
TicTacToe-Game >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) < validate #
TicTacToe-Game <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) # TicTacToe-
Game ---
[WARNING]
java.lang.ClassNotFoundException: com.mertilovski.app.Game
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
at java.lang.Thread.run(Thread.java:748)
[INFO] ------------------------------------------------------------
------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------
------------
[INFO] Total time: 0.639 s
[INFO] Finished at: 2019-03-26T01:30:18+03:00
[INFO] Final Memory: 8M/106M
[INFO] ------------------------------------------------------------
------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-
plugin:1.2.1:java (default-cli) on project TicTacToe-Game: An
exception occured while executing the Java class.
com.mertilovski.app.Game -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven
with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug
logging.
[ERROR]
[ERROR] For more information about the errors and possible
solutions, please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Your XML structure seems incorrect as configuration node should be outside executions (docs):
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.mertilovski.app.Game</mainClass>
</configuration>
Firstly I declared a package com.mertilovski.app in top of my Game.java file.
Than I ran the
mvn exec:java -Dexec.mainClass="com.mertilovski.app.Game"
pom.xml looks like this (remaining part is same)
<configuration>
<mainClass>com.mertilovski.app.Game</mainClass>
</configuration>
When I run find . -type f -name "Game.class" I get :
./src/main/java/com/mertilovski/app/com/mertilovski/app/Game.class
./target/classes/com/mertilovski/app/Game.class
I have created a test for my aspectj class.
When I execute my test it works fine to "Run as TestNG" from Eclipse.
Then when I execute it in maven:
mvn clean test
I get the following error:
[15:15] [eraonel/git/java-runtime-stats] -> mvn clean test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building java-runtime-stats 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # java-runtime-stats ---
[INFO] Deleting /repo/eraonel/git/java-runtime-stats/target
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (default) # java-runtime-stats ---
[INFO] Executing tasks
main:
[echo] BUILDING : /repo/eraonel/git/java-runtime-stats/src/main/java/com/company/commonlibrary/javaruntimestats/Version.java
[echo] BUILD 2018-10-24 13:18 UTC : /repo/eraonel/git/java-runtime-stats/src/main/java/com/company/commonlibrary/javaruntimestats/Version.java
[INFO] Executed tasks
[INFO]
[INFO] --- maven-java-formatter-plugin:0.6.1-threadsafe:format (default) # java-runtime-stats ---
[INFO] Using 'UTF-8' encoding to format source files.
[INFO] Number of files to be formatted: 21
[INFO] Successfully formatted: 1 file(s)
[INFO] Fail to format : 0 file(s)
[INFO] Skipped : 20 file(s)
[INFO] Approximate time taken: 0s
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # java-runtime-stats ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /repo/eraonel/git/java-runtime-stats/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # java-runtime-stats ---
[INFO] Compiling 15 source files to /repo/eraonel/git/java-runtime-stats/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # java-runtime-stats ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 11 resources
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) # java-runtime-stats ---
[INFO] Compiling 6 source files to /repo/eraonel/git/java-runtime-stats/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /repo/eraonel/git/java-runtime-stats/src/test/java/com/company/commonlibrary/javaruntimestats/aspects/DeprecatedMethodsAspectTest.java:[17,13] cannot find symbol
symbol: class DeprecatedMethodsAspect
location: class com.company.commonlibrary.javaruntimestats.aspects.DeprecatedMethodsAspectTest
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.127 s
[INFO] Finished at: 2018-10-24T15:18:08+02:00
[INFO] Final Memory: 33M/730M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:testCompile (default-testCompile) on project java-runtime-stats: Compilation failure
[ERROR] /repo/eraonel/git/java-runtime-stats/src/test/java/com/company/commonlibrary/javaruntimestats/aspects/DeprecatedMethodsAspectTest.java:[17,13] cannot find symbol
[ERROR] symbol: class DeprecatedMethodsAspect
[ERROR] location: class com.company.commonlibrary.javaruntimestats.aspects.DeprecatedMethodsAspectTest
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
What am I missing here?
Why is the aspectj not compiled before the test case?
Is there a way to change this?
I used this example ( for the library part) to follow since I am creating a lib that should be used for other applications:
AspectJ: How to weave an aspect library into a Java project
TestClass:
/**
* Unit test to see if pointcut works as expected in ${#link DeprecatedMethodsAspect}
*/
public class DeprecatedMethodsAspectTest {
private DeprecatedMethodsAspect aspect;
private DeprecatedMethods deprecatedMethodsMock;
private DeprecatedMethodsApp app;
#BeforeClass
public void setUp() throws Exception {
app = new DeprecatedMethodsApp();
deprecatedMethodsMock = mock(DeprecatedMethods.class);
when(deprecatedMethodsMock.isActive()).thenReturn(true);
aspect = Aspects.aspectOf(DeprecatedMethodsAspect.class);
aspect.setDeprecatedMethods(deprecatedMethodsMock);
}
#Test
public void testSumIsMatched() throws Throwable {
app.sum(1, 2);
verify(deprecatedMethodsMock, times(1)).collect(any(JoinPoint.class));
}
#Test(description = " we should not gather information from methods annotated #Beta.")
public void testSubIsNotMatched() throws Throwable {
app.sub(2, 1);
verify(deprecatedMethodsMock, times(0)).collect(any(JoinPoint.class));
}
}
This is excerpt from my pom.xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Compile scope dependencies -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<!-- IMPORTANT -->
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${java.version}</version>
<configuration>
<showWeaveInfo>true</showWeaveInfo>
<source>${java.version}</source>
<target>${java.version}</target>
<Xlint>ignore</Xlint>
<complianceLevel>${java.version}</complianceLevel>
<encoding>${project.build.sourceEncoding}</encoding>
<!--<verbose>true</verbose> -->
<!--<warn>constructorName,packageDefaultMethod,deprecation,maskedCatchBlocks,unusedLocals,unusedArguments,unusedImport</warn> -->
</configuration>
<executions>
<execution>
<!-- IMPORTANT -->
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
You've included the aspectj-maven-plugin in <pluginManagement/> but you haven't included it in <plugins>
Try adding:
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
</plugin>
</plugins>
under the <build/> element.
See also: Maven: What is pluginManagement?
When I am trying to run a Maven with JUnit test in an eclipse project I've got this ERROR below:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building exemplo-maven 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # exemplo-maven ---
[INFO] Deleting C:\Users\vcamargo\workspace\exemplo-maven\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # exemplo-maven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # exemplo-maven ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\vcamargo\workspace\exemplo-maven\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # exemplo-maven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # exemplo-maven ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\vcamargo\workspace\exemplo-maven\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # exemplo-maven ---
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.12.4/maven-surefire-common-2.12.4.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting-api/2.0.9/maven-reporting-api-2.0.9.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-toolchain/2.0.9/maven-toolchain-2.0.9.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.470 s
[INFO] Finished at: 2017-02-27T10:08:30-03:00
[INFO] Final Memory: 19M/153M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project exemplo-maven: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-surefire-plugin:jar:2.12.4 -> org.apache.maven.surefire:surefire-booter:jar:2.12.4: Failed to read artifact descriptor for org.apache.maven.surefire:surefire-booter:jar:2.12.4: Could not transfer artifact org.apache.maven.surefire:surefire-booter:pom:2.12.4 from/to central (https://repo.maven.apache.org/maven2): RSA premaster secret error: SunTls12RsaPremasterSecret KeyGenerator not available -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Following my pom.xml below:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.algaworks.curso</groupId>
<artifactId>exemplo-maven</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<killAfter>-1</killAfter>
<mainClass>com.algaworks.curso.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
My main class:
package com.algaworks.curso;
public class Main {
public static void main(String[] args) {
System.out.println("Hello Maven");
}
}
And finally my test class:
package com.algaworks.curso;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class FibonacciTest {
#Test
public void deve_retornar_fibonacci_posicao_1() {
assertEquals(1L, 1L);
}
}
When I run my test class individually it runs perfect. And if I try to run a Maven project without test (goal: exec:java) it runs perfect too.
The error occur just when I try to run the Maven project with the JUnit test (goal: clean project).
Error says dependencies which are directly or indirectly used by surefire plug-in can not be resolved. i never had this error but, delete your maven-surefire-plugin folder from location : ".m2\repository\org\apache\maven\plugins"
and re-run the build which will automatically re-download all the plugin files.
make sure to have aback up of the folder before deleting so that you can analyse what were missing.
From the logs you've posted it seems like issue is not with your JUnit test cases, but with your maven not able to download few artifacts..In the repo I could see a maven surefire booter jar of required version..I guess there is some issue with network firewalls or connectivity...can we try reconnecting to network and then running a goal ?
I've created a simple Web app from jersey archetype in Eclipse and followed the tutorial given here, but the command mvn -e heroku:deploy-war throws the following errors
$ mvn -e heroku:deploy-war
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building wallpost 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> heroku-maven-plugin:1.1.1:deploy-war (default-cli) > package # wallpost >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # wallpost ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # wallpost ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # wallpost ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Workspace For Java\wallpost\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # wallpost ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # wallpost ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # wallpost ---
[INFO] Packaging webapp
[INFO] Assembling webapp [wallpost] in [D:\Workspace For Java\wallpost\target\wallpost]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Workspace For Java\wallpost\src\main\webapp]
[INFO] Webapp assembled in [187 msecs]
[INFO] Building war: D:\Workspace For Java\wallpost\target\wallpost.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] --- maven-dependency-plugin:2.3:copy-dependencies (copy-dependencies) # wallpost ---
[INFO] hk2-api-2.5.0-b05.jar already exists in destination.
[INFO] jersey-guava-2.23.2.jar already exists in destination.
[INFO] hk2-utils-2.5.0-b05.jar already exists in destination.
[INFO] javassist-3.20.0-GA.jar already exists in destination.
[INFO] osgi-resource-locator-1.0.1.jar already exists in destination.
[INFO] jersey-server-2.23.2.jar already exists in destination.
[INFO] jersey-client-2.23.2.jar already exists in destination.
[INFO] javax.ws.rs-api-2.0.1.jar already exists in destination.
[INFO] hk2-locator-2.5.0-b05.jar already exists in destination.
[INFO] jersey-container-servlet-core-2.23.2.jar already exists in destination.
[INFO] jersey-common-2.23.2.jar already exists in destination.
[INFO] validation-api-1.1.0.Final.jar already exists in destination.
[INFO] aopalliance-repackaged-2.5.0-b05.jar already exists in destination.
[INFO] jersey-media-jaxb-2.23.2.jar already exists in destination.
[INFO] javax.inject-2.5.0-b05.jar already exists in destination.
[INFO] javax.annotation-api-1.2.jar already exists in destination.
[INFO]
[INFO] --- maven-dependency-plugin:2.3:copy (default) # wallpost ---
[INFO] Configured Artifact: com.github.jsimone:webapp-runner:8.0.30.2:jar
[INFO] com.github.jsimone:webapp-runner:8.0.30.2:jar already exists in D:\Workspace For Java\wallpost\target\dependency
[INFO]
[INFO] <<< heroku-maven-plugin:1.1.1:deploy-war (default-cli) < package # wallpost <<<
[INFO]
[INFO] --- heroku-maven-plugin:1.1.1:deploy-war (default-cli) # wallpost ---
[INFO] Configured Artifact: com.github.jsimone:webapp-runner:8.0.30.2:jar
[INFO] com.github.jsimone:webapp-runner:8.0.30.2:jar already exists in D:\Workspace For Java\wallpost\target\dependency
[INFO] -----> Packaging application...
[INFO] - app: immense-beach-86309t
[INFO] - including: target/dependency/webapp-runner.jar
[INFO] - including: target/wallpost.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.865 s
[INFO] Finished at: 2016-10-17T02:43:01+05:30
[INFO] Final Memory: 26M/225M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.heroku.sdk:heroku-maven-plugin:1.1.1:deploy-war (default-cli) on project wallpost: Failed to deploy application: Not Found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.heroku.sdk:heroku-maven-plugin:1.1.1:deploy-war (default-cli) on project wallpost: Failed to deploy application
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to deploy application
at com.heroku.sdk.maven.DeployWarMojo.execute(DeployWarMojo.java:26)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: org.apache.http.client.HttpResponseException: Not Found
at com.heroku.sdk.deploy.utils.RestClient.handleResponse(RestClient.java:172)
at com.heroku.sdk.deploy.utils.RestClient.get(RestClient.java:66)
at com.heroku.sdk.deploy.ConfigVars.getConfigVars(ConfigVars.java:41)
at com.heroku.sdk.deploy.ConfigVars.merge(ConfigVars.java:24)
at com.heroku.sdk.deploy.Deployer.mergeConfigVars(Deployer.java:106)
at com.heroku.sdk.deploy.Deployer.deploy(Deployer.java:68)
at com.heroku.sdk.deploy.App.deploy(App.java:57)
at com.heroku.sdk.deploy.App.deploy(App.java:61)
at com.heroku.sdk.deploy.WarApp.deploy(WarApp.java:30)
at com.heroku.sdk.maven.DeployWarMojo.execute(DeployWarMojo.java:22)
... 22 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
I have also tried the suggestions mentioned here, here, here and here, but they were of no use. I made sure the app name on Heroku matched the <appName></appName> in pom.xml, but that too didn't solve the problem.
Following is my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.auro.assignment</groupId>
<artifactId>wallpost</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>wallpost</name>
<build>
<finalName>wallpost</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals><goal>copy-dependencies</goal></goals>
</execution>
<execution>
<phase>package</phase>
<goals><goal>copy</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>8.0.30.2</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<configuration>
<jdkVersion>1.8</jdkVersion>
<appName>immense-beach-86309t</appName>
</configuration>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>1.1.1</version>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<!-- use the following artifactId if you don't need servlet 2.x compatibility -->
<!-- artifactId>jersey-container-servlet</artifactId -->
</dependency>
<!-- uncomment this to get JSON support
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
</dependency>
-->
</dependencies>
<properties>
<jersey.version>2.23.2</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Below is the Procfile
web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war
I suspect that your app name is supposed to be "immense-beach-86309" but you have "immense-beach-86309t" (note the trailing "t") in your pom.xml entry for <appName>.
The error message should be better, and I've opened an issue on the heroku-maven-plugin project, which is open source.
I trying to run weblocig server with maven (wls-maven-plugin). But, i recieve NullPointerException:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building web_application Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- wls-maven-plugin:12.1.2.0:start-server (default-cli) # web_application ---
[INFO] ++====================================================================++
[INFO] ++ wls-maven-plugin: start-server ++
[INFO] ++====================================================================++
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.236 s
[INFO] Finished at: 2015-02-25T10:42:19+02:00
[INFO] Final Memory: 7M/103M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.oracle.weblogic:wls-maven-plugin:12.1.2.0:start-server (default-cli) on project web_application: Error starting server: NullPointerException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Process finished with exit code 1
My pom.xml:
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Lab3.web_application</groupId>
<artifactId>web_application</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>web_application Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>web_application</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-site</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.oracle.weblogic</groupId>
<artifactId>wls-maven-plugin</artifactId>
<version>12.1.2.0</version>
<configuration>
<middlewareHome>c:/Oracle/Middleware/Oracle_Home</middlewareHome>
<adminurl>http://localhost:7001</adminurl>
<domainHome>c:/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain</domainHome>
<user>weblogic</user>
<password>password123</password>
<upload>true</upload>
<remote>false</remote>
<verbose>true</verbose>
<source>./target/web_application.war</source>
<name>${project.build.finalName}</name>
<noexit>true</noexit>
</configuration>
<executions>
<execution>
<id>wls-start-domain</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
</execution>
<!--<execution>
<phase>post-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>-->
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>localSnapshot</id>
<name>local snapshot repository</name>
<url>file:///c:/Users/Admin/.m2/repository</url>
</snapshotRepository>
</distributionManagement>
</project>
running with -e flag:
"C:\Program Files\Java\jdk1.7.0_75\bin\java" "-Dmaven.home=C:\Program Files\Apache Software Foundation\apache-maven-3.2.5" "-Dclassworlds.conf=C:\Program Files\Apache Software Foundation\apache-maven-3.2.5\bin\m2.conf" -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.0.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Apache Software Foundation\apache-maven-3.2.5\boot\plexus-classworlds-2.5.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.0.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=14.0.3 deploy -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building web_application Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # web_application ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # web_application ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # web_application ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Dropbox\NetCracker\Lab3\web_application\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # web_application ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # web_application ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # web_application ---
[INFO] Packaging webapp
[INFO] Assembling webapp [web_application] in [D:\Dropbox\NetCracker\Lab3\web_application\target\web_application]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Dropbox\NetCracker\Lab3\web_application\src\main\webapp]
[INFO] Webapp assembled in [78 msecs]
[INFO] Building war: D:\Dropbox\NetCracker\Lab3\web_application\target\web_application.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] --- wls-maven-plugin:12.1.2.0:start-server (wls-start-domain) # web_application ---
[INFO] ++====================================================================++
[INFO] ++ wls-maven-plugin: start-server ++
[INFO] ++====================================================================++
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.155 s
[INFO] Finished at: 2015-02-25T22:14:52+02:00
[INFO] Final Memory: 12M/103M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.oracle.weblogic:wls-maven-plugin:12.1.2.0:start-server (wls-start-domain) on project web_application: Error starting server: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.oracle.weblogic:wls-maven-plugin:12.1.2.0:start-server (wls-start-domain) on project web_application: Error starting server
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: org.apache.maven.plugin.MojoFailureException: Error starting server
at weblogic.tools.maven.plugins.control.StartServerMojo.execute(StartServerMojo.java:112)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 25 more
Caused by: java.lang.NullPointerException
at weblogic.tools.maven.plugins.configure.RunScriptMojo.transformString(RunScriptMojo.java:186)
at weblogic.tools.maven.plugins.control.StartServerMojo.defaultArgs(StartServerMojo.java:127)
at weblogic.tools.maven.plugins.control.StartServerMojo.execute(StartServerMojo.java:57)
... 27 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Process finished with exit code 1
I run it in Intellij IDEA > execute maven goal > wls:start-server.
P.S. Running manualy by call: c:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\startWebLogic.cmd was sucessful.