Why does Maven waste over 12 seconds? - maven

Simply put, I get this result
$ time mvn generate-sources ; date
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building connect-ui 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (default) # connect-ui ---
[INFO] Executing tasks
<Ant task that does a copy followed by a search and replace.>
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.637 s
[INFO] Finished at: 2015-05-19T18:14:14+02:00
[INFO] Final Memory: 9M/311M
[INFO] ------------------------------------------------------------------------
real 0m13.057s
user 0m15.760s
sys 0m0.246s
Tue May 19 18:14:26 CEST 2015
real 0m13.036s
user 0m15.807s
sys 0m0.292s
By Maven's output, it would seem that the task is complete. And indeed, the source it generated is available right after the BUILD SUCCESS has been printed.
But clearly it is wasting some more time. What can it be, and how do I make Maven stop wasting those 12 seconds?
FWIW,
$ java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
Running with -X (or --debug) makes no difference - Maven still says BUILD SUCCESS and then there is a waiting period (with no further output).
For fun I also tried mvn clean test:
time mvn -X clean ; date
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T22:58:10+02:00)
Maven home: /usr/local/Cellar/maven/3.2.3/libexec
Java version: 1.8.0_11, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.299 s
[INFO] Finished at: 2015-05-19T18:22:44+02:00
[INFO] Final Memory: 7M/291M
[INFO] ------------------------------------------------------------------------
real 0m12.805s
user 0m14.739s
sys 0m0.196s
Tue May 19 18:22:56 CEST 2015

Related

Test file is not running via maven on azure pipeline

I'm using maven for building the automation project and using junit for running my test scripts . Its BBD framework where we have feature file, stepdefinition page.I have created pipeline , agent on azure devops . When running the pipeline it showing as build successful but still no tests cases are running .
Logs in maven :-
2022-10-07T13:21:37.3334382Z ##[section]Starting: Maven SmartBots/pom.xml
2022-10-07T13:21:37.3341187Z ==============================================================================
2022-10-07T13:21:37.3341428Z Task : Maven
2022-10-07T13:21:37.3341633Z Description : Build, test, and deploy with Apache Maven
2022-10-07T13:21:37.3341821Z Version : 3.169.2
2022-10-07T13:21:37.3341987Z Author : Microsoft Corporation
2022-10-07T13:21:37.3342231Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/maven
2022-10-07T13:21:37.3342495Z ==============================================================================
2022-10-07T13:21:38.2158528Z [command]/usr/bin/mvn -version
2022-10-07T13:21:38.2158912Z Apache Maven 3.5.4 (Red Hat 3.5.4-5)
2022-10-07T13:21:38.2159093Z Maven home: /usr/share/maven
2022-10-07T13:21:38.2159584Z Java version: 1.8.0_345, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.el8_6.x86_64/jre
2022-10-07T13:21:38.2160036Z Default locale: en_US, platform encoding: UTF-8
2022-10-07T13:21:38.2160548Z OS name: "linux", version: "4.18.0-372.26.1.el8_6.x86_64", arch: "amd64", family: "unix"
2022-10-07T13:21:38.2163101Z SYSTEMVSSCONNECTION exists true
2022-10-07T13:21:38.2164119Z [command]/usr/bin/mvn -f /E/azdosagents/agent2/_work/113/s/SmartBots/pom.xml test
2022-10-07T13:21:38.7149886Z [INFO] Scanning for projects...
2022-10-07T13:21:38.7906399Z [INFO]
2022-10-07T13:21:38.7921739Z [INFO] ------------------------< com.company:SmartBots >-------------------------
2022-10-07T13:21:38.7923753Z [INFO] Building com.optum.ManualTracker 0.1.1-SNAPSHOT
2022-10-07T13:21:38.7925045Z [INFO] --------------------------------[ jar ]---------------------------------
2022-10-07T13:21:39.7344370Z [INFO]
2022-10-07T13:21:39.7433482Z [INFO] --- maven-resources-plugin:2.6:resources (default-resources) # SmartBots ---
2022-10-07T13:21:39.7994520Z [INFO] Using 'UTF-8' encoding to copy filtered resources.
2022-10-07T13:21:39.8047081Z [INFO] Copying 21 resources
2022-10-07T13:21:39.8074402Z [INFO]
2022-10-07T13:21:39.8075718Z [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # SmartBots ---
2022-10-07T13:21:39.8834648Z [INFO] Nothing to compile - all classes are up to date
2022-10-07T13:21:39.8835474Z [INFO]
2022-10-07T13:21:39.8836068Z [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # SmartBots ---
2022-10-07T13:21:39.8901220Z [INFO] Using 'UTF-8' encoding to copy filtered resources.
2022-10-07T13:21:39.8901907Z [INFO] skip non existing resourceDirectory /E/azdosagents/agent2/_work/113/s/SmartBots/src/test/resources
2022-10-07T13:21:39.8902441Z [INFO]
2022-10-07T13:21:39.8902979Z [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # SmartBots ---
2022-10-07T13:21:39.8903395Z [INFO] No sources to compile
2022-10-07T13:21:39.8903634Z [INFO]
2022-10-07T13:21:39.8904175Z [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # SmartBots ---
2022-10-07T13:21:39.9333349Z [INFO] ------------------------------------------------------------------------
2022-10-07T13:21:39.9334415Z [INFO] BUILD SUCCESS
2022-10-07T13:21:39.9334944Z [INFO] ------------------------------------------------------------------------
2022-10-07T13:21:39.9335464Z [INFO] Total time: 1.237 s
2022-10-07T13:21:39.9337421Z [INFO] Finished at: 2022-10-07T08:21:39-05:00
2022-10-07T13:21:39.9338075Z [INFO] ------------------------------------------------------------------------
2022-10-07T13:21:40.0354312Z No test result files matching /E/azdosagents/agent2/_work/113/s/**/surefire-reports/TEST-*.xml were found, so publishing JUnit test results is being skipped.
2022-10-07T13:21:40.0408313Z ##[section]Finishing: Maven SmartBots/pom.xml

maven build works on windows but fails on linux

I have some project which is maven based.
the same project builds well on the windows but fails on the linux
Windows --------------- :
C:\project\code\microservice\ConfigService>mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.conf:ConfigService >----------------------
[INFO] Building ConfigService 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # ConfigService ---
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # ConfigService ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # ConfigService ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 51 source files to C:\project\code\microservice\ConfigService\target\classes
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) # ConfigService ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\project\code\microservice\ConfigService\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # ConfigService ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) # ConfigService ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:3.1.0:jar (default-jar) # ConfigService ---
[INFO] Building jar: C:\project\code\microservice\ConfigService\target\ConfigService-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.1.0.RELEASE:repackage (repackage) # ConfigService ---
[INFO] Replacing main artifact C:\project\code\microservice\ConfigService\target\ConfigService-0.0.1-SNAPSHO
T.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.811 s
[INFO] Finished at: 2019-03-04T15:42:57+05:30
[INFO] ------------------------------------------------------------------------
Linux------------
user#myhost:~/project/work/ConfigService$ mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.conf:ConfigService >----------------------
[INFO] Building ConfigService 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # ConfigService ---
[INFO] Deleting /home/user/project/work/ConfigService/target
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # ConfigService ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # ConfigService ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 51 source files to /home/user/project/work/ConfigService/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.479 s
[INFO] Finished at: 2019-03-04T05:28:06-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ConfigService: Compilation failure -> [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
So what would be the major cause for this issue, looks everything fine from other option
On ubuntu I have Java version
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T14:41:47-04:00)
Maven home: /home/user/tools/maven/apache-maven-3.6.0
Java version: 1.8.0_191, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-29-generic", arch: "amd64", family: "unix"
On windows
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T00:11:47+05:30)
Maven home: C:\project\softs\apache-maven-3.6.0\bin..
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_201\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows
If the log you pasted is original then I could see that on linux path is not correct
/home/user/project/work/ConfigServicetarget/classes
After ConfigService it should use /
try to see in your files which config is missing or you need yo provide your source code.

TeamCity/Maven DONT make modules be 'SKIPPED'

Lets say I've a root project called R. And it has modules A, B, C and D as submodules but each is an application.
Whenever I use teamcity/maven and there is an error it skips other modules whether its a compile/test.
So,
Whenever compiling it shows
R................SUCCESS
A................SUCCESS
B................FAILURE
C................SKIPPED
D................SKIPPED
And I want to see results in both C and D. How can I achieve this using teamcity/maven. Is there any parameter?
If you use mvn --fail-at-end all modules will be gone through but the failure will be shows only at the end of the build.
This option must be used carefully, but can be useful. The build never fails, regardless of the project result. All failures are ignore, the build just continues. On your project:
mvn clean install --fail-never (or just --fn)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Module A .............................................. SUCCESS [2.583s]
[INFO] Module B .............................................. SUCCESS [0.086s]
[INFO] Module C .............................................. FAILED [1.598s]
[INFO] Module D .............................................. SUCCESS [0.051s]
[INFO] Reactor ............................................... SUCCESS [0.921s]
[INFO] ------------------------------------------------------------------------
[INFO] Error for project: Module C (during install)
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
Please refer to /Users/clement/workspaces/experiments/Project/module-C/target/surefire-reports for the individual test results.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] + Ignoring failures
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Sun May 09 10:43:41 CEST 2010
[INFO] Final Memory: 31M/79M
[INFO] ------------------------------------------------------------------------
Module C failed, D is not skipped, and the global build is successful.
After that in the Teamcity you can add build failure condition for checking the results and failed the build if found any errors

How to debug "The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found"?

This is what I am trying to do. I have installed Maven. Set the path till bin folder of Maven.
C:\Workspace\Eaxample>mvn archetype:generate -DgroupId=com.mkyong -DartifactId=N
umberGenerator
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retri
eved from repository: central due to an error: Error transferring file: Connecti
on timed out: connect
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exi
st or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21 seconds
[INFO] Finished at: Tue Nov 24 14:04:15 IST 2015
[INFO] Final Memory: 5M/122M
You forget archetypeArtifactId :
Do this :
mvn archetype:generate -DgroupId={project-packaging}
-DartifactId={project-name}
-DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=false
http://www.mkyong.com/maven/how-to-create-a-java-project-with-maven/

oozie3.3.2 Build failure while mkdistro.sh command execution

I Getting oozie 3.3.2 from apache.package.org. I can't installed oozie3.3.2 in my system. but I have installed maven in my system.
**Maven version :Apache Maven 2.2.1
Java version: 1.7.0_55**
$/oozie/bin$ ./mkdistro.sh -DskipTests
This line is not executed......
Detailed Error which i am getting
**[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Project 'org.apache.oozie:oozie-hadoop' is duplicated in the reactor
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Fri May 02 15:49:31 IST 2014
[INFO] Final Memory: 5M/117M
[INFO] ------------------------------------------------------------------------
ERROR, Oozie distro creation failed.**
The system requirements specify the necessary version:
Maven 3.0.1+
The mailing list confirms this:
Maven 3 is required for oozie 3.2.

Resources