I need maven to give more detailed logs - java

we have an angular+java app which gets built with maven and I have been trying to decrease our gitlab pipeline duration
i was wondering if there is a way to have better logs
i have tried -e & -X switches in the command (mvn $MAVEN_CLI_OPTS clean install -Dmaven.test.skip=true -P prod)
im also open to suggestions about more detailed angular build log

Related

configure maven command line args in settings.xml or set in intellij Idea IDEA

I have multiple projects where I have to pass the following parameters each time.
-Djavax.net.ssl.trustStore=C:\VALUE
-P aws-build
-DskipTests=TRUE
The complete command is:
mvn -Djavax.net.ssl.trustStore=C:\VALUE clean install -P aws-build -DskipTests=TRUE
I am trying to configure it permanently so that I won't have to put it each time I do mvn clean install
I am looking to put settings in settings.xml or anywhere in intellij or any working solution is welcome. The objective is if I run mvn clean install, it should pick up those parameters automatically. Thanks!
Got help from a friend:
In Intellij Idea we can do this:
open pom.xml file -> run maven -> new goal -> add the followings in command line:
-Djavax.net.ssl.trustStore=C:\VALUE clean install -P aws-build -DskipTests=TRUE
->OK.

Using mvn clean install from cmd, while running the app from intellij its seems like it rebuilding it

I'm trying to automate some mvn commands to set up the dev env in IntelliJ.
I'm running from cmd:
mvn clean install -DskipTests -P profile1,profile2
When it finish, I'm running the app from IntelliJ, it seems like IntelliJ is compelling and building it again before it runs.
Is there a way to add flags to the cmd command in order to save the step of IntelliJ compiling & building it?

How to pass maven options to JaCoCo tool in Maven#3 task in Azure Devops

I am trying to build, run tests and publish JaCoCo code coverage reports using Azure Devops pipelines. I followed the documentation of the task provided in link here
The final task which i am running is something like this:
- task: Maven#3
displayName: Build Project
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean package'
options: '-s settings.xml'
publishJUnitResults: true,
testResultsFiles: '**/surefire-reports/TEST-*.xml'
codeCoverageToolOption: 'jaCoCo'
....
This results tasks runs fails at the verify step. Below is the maven commands those get run:
/usr/share/apache-maven-3.6.3/bin/mvn -version
/usr/share/apache-maven-3.6.3/bin/mvn -f /home/vsts/work/1/s/pom.xml help:effective-pom -s settings.xml
/usr/share/apache-maven-3.6.3/bin/mvn -f /home/vsts/work/1/s/pom.xml -s /home/vsts/work/_temp/settings.xml clean package and finally
/usr/share/apache-maven-3.6.3/bin/mvn -f /home/vsts/work/1/s/pom.xml verify - FAILS
As you can see for step 2 and step 3 both have -s settings.xml in the command, but in case of step 4 (which is initiated by the JaCoCo part of the task), the option (-s settings.xml) is not passed because of which certain dependencies are not getting downloaded and the build is failing.
Can anyone provide me some insights as to how to propagate the maven args to the JaCoCo coverage mvn verify command. Thanks in advance for your help.

Jenkins failing build when not finding ".part" files

I've created a Jenkins job for maven releases. When doing "release:perform" the build fails with messages of this kind:
Caused by: java.io.FileNotFoundException:
/home/jenkins/.m2/repository/org/sonatype/sisu/inject/guice-bean/1.4.2/guice-bean-1.4.2.pom.part (No such file or directory)
The file changes sometimes, but the kind of error is always the same.
When performing the release manually (aka on my own machine) the error does not happen.
My job run the following commands:
mvn clean install
mvn release:clean release:prepare -e -B
mvn -X release:perform -e -Dusername='username' -Dpassword='password' -Darguments="-Dmaven.javadoc.skip=true"
I believe it's related to space on disk or something similar to that. Is there any kind of config to fix it?
ps: the slaves are not running on containers yet
Thanks in advance

Better way to execute code in a Maven artifact directly? (no project)

I really like the ability to be able to take a Maven artifact that has some useful code in it that can be run directly from the command line. You could run utilities directly from the command line or scripts without first having to download/install anything.
Right now I'm doing it like this inside a script:
mvn -q dependency:copy -Dartifact=${GROUPID}:${ARTIFACTID}:${VERSION}:pom -DoutputDirectory=${TARGET}
mvn -q dependency:copy -Dartifact=${GROUPID}:${ARTIFACTID}:${VERSION} -DoutputDirectory=${TARGET}
mvn -q dependency:copy-dependencies -f ${TARGET}/${ARTIFACTID}-${VERSION}.pom -DoutputDirectory=dependencies
java -cp ${TARGET}/\*:${TARGET}/dependencies/\* ${MAIN}
I tried doing it with the exec plugin, hoping that I could condense that into a single mvn call, but I wasn't able to get it to work.
Is there a better way to do this? (Like in a single mvn call)

Categories

Resources