Spring Boot - My unit tests are being skipped - java

I am migrating an existing project to boot. I created a brand new project using start.spring.io and copied over the source code, etc. Everything compiles, but when I do a 'mvn test' it compiles the classes but then only executes the default 'ApplicationTests' (created by start.spring.io).
Here's an excerpt from the maven output:
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # pendview ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\dev\pendview2\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # pendview ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 26 source files to C:\dev\pendview2\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.15:test (default-test) # pendview ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
What's even stranger is that if I pass '-Dtest=TestAuthController' then it does run that specific unit test:
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # pendview ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 26 source files to C:\dev\pendview2\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.15:test (default-test) # pendview ---
[INFO] Surefire report directory: C:\dev\pendview2\target\surefire-reports
(skipped output of AuthControllerTest for brevity)
-------------------------------------------------------
T E S T S
-------------------------------------------------------Results :
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0
What am I doing wrong? Does spring boot setup a surefire config that I'm not conforming to?
Any help would be greatly appreciated!
-Trey

Spring Boot configures the Surefire plugin to run all test classes that have a name ending with Test or Tests but not starting with Abstract. You can see this configuration in the spring-boot-starter-parent pom. If your test class is named TestAuthController then it doesn't match this configuration. Renaming it to AuthControllerTest or AuthControllerTests should fix your problem.

Seems for me there is some issue with Maven surefire plugin, when it doesn't detect tests, if your test class name doesn't end with Tests suffix. :-)

Try this command in your console/terminal:
mvn clean install
But first navigate to directory of your tests.
If you wish to skip tests use this command:
mvn clean install -Dmaven.test.skip

It seems Andy's answer should be updated for Spring Boot 2.X. I can't see surefire config anywhere now. Probably there were too many complains about this convention.

Related

quarkus-cucumber does not find step definitions

I'm trying to set up acceptance tests for a Quarkus app, using quarkus-cucumber 0.6.0 (on Quarkus platform version 2.15.2.Final), but it fails to find the step definitions.
My package structure looks as follows:
src
main
api
backend
gui
test
java
com.example.test
AcceptanceTest.java
steps
BlahSteps.java
BlubbSteps.java
specifications
blah.feature
blubb.feature
The AcceptanceTest.java specifies the package for the glue:
package com.example.test
#CucumberOptions(
features = "src/test/specifications",
glue = "com.example.test.steps"
)
public class AcceptanceTest extends CucumberQuarkusTest {
public static void main(String[] args) {
runMain(AcceptanceTest.class, args);
}
}
And the BlahSteps.java in that package contains methods for the steps in blah.feature. (It also ends up correctly in target/test-classes.)
Still, no matter whether I run mvn clean test in the terminal (or ./mvnw quarkus:test after annotating the AcceptanceTest with #QuarkusTest) or run the test in IntelliJ, it runs the blah feature and tells me:
You can implement missing steps with the snippets below:
...
Why is it not finding the glue? Am I missing something?
Configure surefire plugin like below
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/AcceptanceTest*.java</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemPropertyVariables>
</configuration>
</plugin>
below you can see how cucumber triggered.
mintozzy#laptop:~/tmp/quarkus-cucumber-example$ mvn test
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.example:quarkus-cucumber-example:jar:1.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for io.quarkus.platform:quarkus-maven-plugin is missing. # line 56, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ----------------< com.example:quarkus-cucumber-example >----------------
[INFO] Building quarkus-cucumber-example 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # quarkus-cucumber-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/mintozzy/tmp/quarkus-cucumber-example/src/main/resources
[INFO]
[INFO] --- quarkus-maven-plugin:3.0.0.Alpha2:generate-code (default) # quarkus-cucumber-example ---
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) # quarkus-cucumber-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- quarkus-maven-plugin:3.0.0.Alpha2:generate-code-tests (default) # quarkus-cucumber-example ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # quarkus-cucumber-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) # quarkus-cucumber-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) # quarkus-cucumber-example ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.example.test.AcceptanceTestRunner
2023-01-16 20:05:56,769 INFO [io.quarkus] (main) quarkus-cucumber-example 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.15.2.Final) started in 2.091s. Listening on: http://localhost:8081
2023-01-16 20:05:56,771 INFO [io.quarkus] (main) Profile test activated.
2023-01-16 20:05:56,771 INFO [io.quarkus] (main) Installed features: [cdi, cucumber, resteasy, resteasy-jackson, smallrye-context-propagation, vertx]
Scenario: You're still alright # specifications/everything_is_fine.feature:9
Given you are having coffee # com.example.test.steps.EverythingIsFineSteps.you_are_having_coffee()
And there is a fire around you # com.example.test.steps.EverythingIsFineSteps.there_is_a_fire_around_you()
When you are still alright # com.example.test.steps.EverythingIsFineSteps.you_are_still_alright()
Then everything is fine # com.example.test.steps.EverythingIsFineSteps.everything_is_fine()
Scenario: You start to feel it # specifications/everything_is_fine.feature:14
Given you are having coffee # com.example.test.steps.EverythingIsFineSteps.you_are_having_coffee()
And there is a fire around you # com.example.test.steps.EverythingIsFineSteps.there_is_a_fire_around_you()
When you start to feel it # com.example.test.steps.EverythingIsFineSteps.you_start_to_feel_it()
Then panic # com.example.test.steps.EverythingIsFineSteps.panic()
2 Scenarios (2 passed)
8 Steps (8 passed)
0m0.893s
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.11 s - in com.example.test.AcceptanceTestRunner
2023-01-16 20:05:58,732 INFO [io.quarkus] (main) quarkus-cucumber-example stopped in 0.035s
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.311 s
[INFO] Finished at: 2023-01-16T20:05:58Z
[INFO] ------------------------------------------------------------------------
here is the full code.

Why IntelliJ testing doesn't work with multi-module Spring project, while it works with a single module project?

I have a project where its structure is multi-module then IntelliJ testing with coverage doesn't work, and maven clean install also fails in the install phase where it runs tests. When the project is a single module project everything works just fine.
The project with single module can be found here, multi-module version here.
The error output says the following. Yes, it is a compilation error which I don't understand. Why mvn clean test works (stuff needed to be on the path) and why mvn clean install doesn't. The debug output in both cases says that all the stuff is added tot he path.
I know my approach to split the app to small pieces (interfaces, implementations, tests, and when it comes then exceptions) might be overengineered. However shovel everything into a single module is just a mess for me.
[INFO] Building repositories.tests 1.0.0-SNAPSHOT
[13/16] [INFO] --------------------------------[ jar
]--------------------------------- [INFO] [INFO] ---
maven-clean-plugin:3.2.0:clean (default-clean) # repositories.tests
--- [INFO] Deleting /Users/andrascsanyi/DEV/github.com/EncyclopediaGalactica/EG/repositories.tests/target
[INFO] [INFO] --- maven-resources-plugin:3.2.0:resources
(default-resources) # repositories.tests --- [INFO] Using 'UTF-8'
encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to
copy filtered properties files. [INFO] skip non existing
resourceDirectory
/Users/andrascsanyi/DEV/github.com/EncyclopediaGalactica/EG/repositories.tests/src/main/resources
[INFO] skip non existing resourceDirectory
/Users/andrascsanyi/DEV/github.com/EncyclopediaGalactica/EG/repositories.tests/src/main/resources
[INFO] [INFO] --- maven-compiler-plugin:3.10.1:compile
(default-compile) # repositories.tests --- [INFO] No sources to
compile [INFO] [INFO] --- maven-resources-plugin:3.2.0:testResources
(default-testResources) # repositories.tests --- [INFO] Using 'UTF-8'
encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to
copy filtered properties files. [INFO] skip non existing
resourceDirectory
/Users/andrascsanyi/DEV/github.com/EncyclopediaGalactica/EG/repositories.tests/src/test/resources
[INFO] [INFO] --- maven-compiler-plugin:3.10.1:testCompile
(default-testCompile) # repositories.tests --- [INFO] Changes detected
recompiling the module! [INFO] Compiling 2 source files to /Users/andrascsanyi/DEV/github.com/EncyclopediaGalactica/EG/repositories.tests/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : [INFO]
------------------------------------------------------------- [ERROR] /Users/andrascsanyi/DEV/github.com/EncyclopediaGalactica/EG/repositories.tests/src/test/java/com/encyclopediagalactica/sourceformats/repositories/sourceformat/SaveTests.java:[5,47]
cannot find symbol symbol: class SourceFormatServiceApplication
location: package com.encyclopediagalactica.sourceformats [ERROR]
/Users/andrascsanyi/DEV/github.com/EncyclopediaGalactica/EG/repositories.tests/src/test/java/com/encyclopediagalactica/sourceformats/repositories/sourceformat/FindAllTests.java:[16,54]
cannot find symbol symbol: class SourceFormatServiceApplication
location: package com.encyclopediagalactica.sourceformats [ERROR]
/Users/andrascsanyi/DEV/github.com/EncyclopediaGalactica/EG/repositories.tests/src/test/java/com/encyclopediagalactica/sourceformats/repositories/sourceformat/SaveTests.java:[15,33]
cannot find symbol symbol: class SourceFormatServiceApplication
[INFO] 3 errors [INFO]
------------------------------------------------------------- [INFO] ------------------------------------------------------------------------

cygwin introduces spaces in the console output when running a maven build for a java project in windows 10

Check the following output fragment from a cygwin64 terminal on windows 10 64bit while running a maven 3 build using java 1.8:
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\proj\t020-domain\src\ test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # t020-domain ---
m
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source f iles to C:\proj\t020-domain\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # t020-domain ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) # t020-domain ---
[INFO] Building jar: C:\proj\t020-domain\target\t020-domain-80.1-SNAPSHOT.jar
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.4:prepare-agent-integration (default-prepare-agent-integration) #
36mt020-domain ---
[INFO] argLine set to -javaagent:C:\\Users\\VBO07\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.4\\org.jacoco.agent-0
.8.4-runtime.jar=destfile=C:\\proj\\t020-domain\\target\\jacoco-it.exec
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:integration-test (default) # t020-domain ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:verify (default) # t020-domain ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.4:report (default- report) # t020-domain ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.4:report-integration (def ault-report-integration) # t020-domain
---
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.4:check (default-check) # t020-domain ---
[INFO] Skipping JaCoCo execution due to mi ssing execution data file:C:\proj\t020-domain\target\jacoco.exec
You can see it clearly happening on the lines:
[INFO] skip non existing resourceDirectory C:\proj\t020-domain\src\ test\resources
and
[INFO] Compiling 2 source f iles to C:\proj\t020-domain\target\test-classes
and
[INFO] --- jacoco-maven-plugin:0.8.4:report (default- report) # t020-domain ---
and
[INFO] --- jacoco-maven-plugin:0.8.4:report-integration (def ault-report-integration) # t020-domain
and
[INFO] Skipping JaCoCo execution due to mi ssing execution data file:C:\proj\t020-domain\target\jacoco.exec
How can I fix this?
Thank you.
After posting this problem on cygwin's website, Marco Atzeri gave a solution that works for me: set in windows's environment variables:
CYGWIN="disable_pcon"
Then, obviously, restart cygwin.
EDIT:
The above solution has a big bad side-effect: if you need to run interactive commands with cmd /C, then the then above flag will kill the interactions (waiting for input for example will not work anymore). A better solution that does not have this problem was posted by Takashi Yano on cygwin as answer to my question: replace the jar jansi-1.17.1.jar in the lib folder of maven with jansi-2.1.1.jar. You can download the 2.1.1 version from https://mvnrepository.com/artifact/org.fusesource.jansi/jansi/2.1.1

Maven: 'mvn package' taking 30 seconds for one file change?

Apologies if this is an obvious issue but my primary background isn't Java and it seems like I am doing something wrong. When I make changes to my source code I run mvn package to update this and produce a .jar.
Currently this command takes an average of 25 seconds each time, the device compiling it has 8 cores with 16 GB of RAM, so I can't see it being the performance of the machine.
What can I change to speed up my build times?
I've tried using multiple threads with mvn package, it doesn't seem to make any difference.
Here is the output log
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.eu.habbo:Habbo:jar:2.4.0
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.google.code.gson:gson:jar -> duplicate declaration of version 2.8.6 # line 173, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] -------------------------< com.eu.habbo:Habbo >-------------------------
[INFO] Building Habbo 2.4.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Habbo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # Habbo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1799 source files to C:\Users\ash\Documents\roleplay-emulator\target\classes
[WARNING] /C:/Users/ash/Documents/roleplay-emulator/src/main/java/com/eu/habbo/Emulator.java:[22,52] com.sun.org.apache.xpath.internal.operations.Bool is internal proprietary API and may be removed in a future release
[INFO] /C:/Users/ash/Documents/roleplay-emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java: Some input files use or override a deprecated API.
[INFO] /C:/Users/ash/Documents/roleplay-emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java: Recompile with -Xlint:deprecation for details.
[INFO] /C:/Users/ash/Documents/roleplay-emulator/src/main/java/com/eu/habbo/networking/rconserver/RCONServer.java: Some input files use unchecked or unsafe operations.
[INFO] /C:/Users/ash/Documents/roleplay-emulator/src/main/java/com/eu/habbo/networking/rconserver/RCONServer.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # Habbo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\ash\Documents\roleplay-emulator\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # Habbo ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # Habbo ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # Habbo ---
[INFO] Building jar: C:\Users\ash\Documents\roleplay-emulator\target\Habbo-2.4.0.jar
[INFO]
[INFO] --- maven-assembly-plugin:3.3.0:single (make-assembly) # Habbo ---
[INFO] Building jar: C:\Users\ash\Documents\roleplay-emulator\target\Habbo-2.4.0-jar-with-dependencies.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29.837 s
[INFO] Finished at: 2020-10-26T06:15:39Z
[INFO] ------------------------------------------------------------------------
C:\Users\ash\Documents\roleplay-emulator>
The bottleneck seems to be in these lines here,
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1799 source files to C:\Users\ash\Documents\roleplay-emulator\target\classes
This is a normal amount of time.
I does not bother me a lot because why I work, Eclipse compiles the files in the background and I can see compile errors immediately. Also running JUnit tests through Eclipse works fine.
I only run Maven when I need the complete artifact.

Maven build skips clean and validate phases

I am using IntelliJ IDE. My project is maven project. What is bothering me is that when for example choose "Install" phase from Maven Toolbar and click "Run Maven Build",
the clean phase is not executed:
"C:\Program Files\Java\jdk-9.0.1\bin\java" -Dmaven.multiModuleProjectDirectory=A:\custom_software_projects\IdeaProjects\power_management "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.2\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.2\plugins\maven\lib\maven3\bin\m2.conf" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.2\lib\idea_rt.jar=53577:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.2\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2017.3.2 install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building power_server 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # power_server ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # power_server ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # power_server ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory A:\custom_software_projects\IdeaProjects\power_management\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # power_server ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # power_server ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # power_server ---
[INFO]
[INFO] --- maven-assembly-plugin:2.2-beta-5:single (default) # power_server ---
[INFO] Building jar: A:\custom_software_projects\IdeaProjects\power_management\target\power_server-1.0-SNAPSHOT-jar-with-dependencies.jar
[INFO]
[INFO] --- maven-dependency-plugin:3.0.2:unpack-dependencies (unpack-sigar) # power_server ---
[INFO] log4j:log4j:jar:1.2.17 already exists in destination.
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # power_server ---
[INFO] Installing A:\custom_software_projects\IdeaProjects\power_management\target\power_server-1.0-SNAPSHOT.jar to C:\Users\ggeorgiev\.m2\repository\Power_Management_Server\power_server\1.0-SNAPSHOT\power_server-1.0-SNAPSHOT.jar
[INFO] Installing A:\custom_software_projects\IdeaProjects\power_management\pom.xml to C:\Users\ggeorgiev\.m2\repository\Power_Management_Server\power_server\1.0-SNAPSHOT\power_server-1.0-SNAPSHOT.pom
[INFO] Installing A:\custom_software_projects\IdeaProjects\power_management\target\power_server-1.0-SNAPSHOT-jar-with-dependencies.jar to C:\Users\ggeorgiev\.m2\repository\Power_Management_Server\power_server\1.0-SNAPSHOT\power_server-1.0-SNAPSHOT-jar-with-dependencies.jar
[INFO]
[INFO] --- maven-antrun-plugin:1.4:run (Copying jar-with-dependecnies and fixing LF in .sh scripts) # power_server ---
project.artifactId
[INFO] Executing tasks
[copy] Copying 1 file to A:\custom_programs\power_server
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.291 s
[INFO] Finished at: 2018-02-10T21:42:17+02:00
[INFO] Final Memory: 17M/56M
[INFO] ------------------------------------------------------------------------
Process finished with exit code 0
So, as you see the first step taken is maven-resources-plugin:2.6:resources. From what I understood from maven docs is that when we specify a phase all previous phases are executed up to the chosen one. Per maven doc:
This command executes each default life cycle phase in order (validate, compile, package, etc.), before executing install. You only need to call the last build phase to be executed, in this case, install
Why is it skipping the clean and validate phases?
Edit:
I also have the clean phase in the Run Configuration section, but the result is the same:
Maven has 3 different builtin lifecycles
There are three built-in build lifecycles: default, clean and site.
install is part of the default lifecycle and there is no reason for clean to execute when you do install.
As to validate it has no built in binding as you can see here which means that it's not going to execute:
Furthermore, a build phase can also have zero or more goals bound to it. If a build phase has no goals bound to it, that build phase will not execute.
The default lifecycle does not include clean in it. Check the docs
Quote:
For example, the default lifecycle comprises of the following phases
(for a complete list of the lifecycle phases, refer to the Lifecycle
Reference):
validate - validate the project is correct and all necessary
information is available
compile - compile the source code of the
project
test - test the compiled source code using a suitable unit
testing framework. These tests should not require the code be packaged
or deployed
package - take the compiled code and package it in its
distributable format, such as a JAR.
verify - run any checks on
results of integration tests to ensure quality criteria are met
install - install the package into the local repository, for use as a
dependency in other projects locally
deploy - done in the build
environment, copies the final package to the remote repository for
sharing with other developers and projects.
Also, the validate phase is not associated with the default lifecycle of packaging .jar files.
Check the Default Lifecycle Bindings for JAR files at the bottom of the docs

Categories

Resources