Error generating RPM package jenkins with rpm-maven-plugin - java

After formatting the previous builds set up a new server using Ubuntu 4.12 32bit with XFCE . I installed and configured the jenkins however when trying to generate some build the system returns the following error:
[INFO] --- rpm-maven-plugin:2.1-alpha-3:rpm (default) # satserver ---
**[WARNING] /bin/sh: 1: rpm: Permission denied**
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.745 s
[INFO] Finished at: 2015-09-02T09:02:35-03:00
[INFO] Final Memory: 33M/378M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1-alpha-3:rpm (default) on project satserver: RPM query for default vendor returned: '127' executing '/bin/sh -c rpm -E '%{_host_vendor}'' -> [Help 1]
The configuration of the maven looks like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1-alpha-3</version>
<extensions>true</extensions>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<copyright>........
Solution
The answer from our friend Etan Reisner is correct. I installed the RPM package in Ubuntu and it worked properly. Thank you.

Related

changing destination folder of resources in maven

I copied pasted the following snippet taken from the doc in my pom.xml
<plugin>
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/resources</outputDirectory>
<resources>
<resource>
<directory>${basedir}/template</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
but I get the following message when I try to trigger the deployment:
$ mvn resources:copy-resources
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.test:myproject >------------------------
[INFO] Building myproject-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:copy-resources (default-cli) # myproject ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.440 s
[INFO] Finished at: 2021-12-26T12:30:59+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:copy-resources (default-cli) on project myproject: The parameters 'resources', 'outputDirectory' for goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:copy-resources are missing or invalid -> [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/PluginParameterException
here's my dir structures:
./resources
./template
./template/test.txt
./pom.xml
How can I change the destination folder of resources? why maven did not parse the configuration directives in the plugin?
The full command syntax to execute a particular maven goal is :
mvn <plugin>:<goal>#<executionId>
When executionId is not specified , it is equal to default-cli by default.
Now you execute mvn resources:copy-resources which is equivalent to mvn resources:copy-resources#default-cli but your pom.xml does not defined this execution id for this goal. So it complains some parameters are missing and not configured well.
As you define the execution id to be copy-resources , which means you should execute :
mvn resources:copy-resources#copy-resources
Or as you bind this goal to the validate phase , that means you can also simply execute it by :
mvn validate

Resolution will not be attempted until the update interval of company_repository has elapsed or updates are forced

I already have seen answers to this problems several time and I tried them too.
I am trying to use grooy-all and groovy-maven-plugin in my project and the dependencies in pom.xml is:
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-all</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>Kryst-reports-flex</id>
<phase>prepare-package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<scriptpath>
<element>src/main/resources</element>
</scriptpath>
<source>ReportsAssembly.buildFlex(ant, project)
</source>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<executions>
<execution>
<id>Kryst-reports-flex</id>
<phase>prepare-package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<scriptpath>
<element>src/main/resources</element>
</scriptpath>
<source>ReportsAssembly.buildFlex(ant, project)
</source>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.5.2</version>
</dependency>
</dependencies>
</plugin>
I am getting error when I am trying to do mvn package or mvn install on this project. The error is:
Failure to find org.codehaus.gmaven:groovy-all:jar:2.5.2 in http://myrepo:9090/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of Z-nexus-public has elapsed or updates are forced pom.xml /cockpit-repo line 1 Maven Configuration Problem
I tried to do mvn clean install -U and right click on project -> Maven -> update project with Update snapshots.
But nothing has worked till now.
Could anyone please help me regarding this?
Thanks in advance
PS: I tried mvn dependency:purge-local-repository clean install . It also gives error:
INFO] Downloading from : http://myrepo:9090/nexus/content/groups/public/org/codehaus/gmaven/groovy-maven-plugin/maven-metadata.xml
[INFO] Downloading from : http://myrepo:9090/nexus/content/groups/public-snapshots/org/codehaus/gmaven/groovy-maven-plugin/maven-metadata.xml
[INFO] Downloading from : https://repo.maven.apache.org/maven2/org/codehaus/gmaven/groovy-maven-plugin/maven-metadata.xml
[INFO] Downloaded from : https://repo.maven.apache.org/maven2/org/codehaus/gmaven/groovy-maven-plugin/maven-metadata.xml (368 B at 1.0 kB/s)
[INFO] Downloaded from : http://myrepo:9090/nexus/content/groups/public/org/codehaus/gmaven/groovy-maven-plugin/maven-metadata.xml (368 B at 511 B/s)
[INFO]
[INFO] ---------------< com.zetes.crystal:cockpit-reports-flex >---------------
[INFO] Building Cockpit reports Flex components 3.2.1-MB-18
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] Downloading from : http://myrepo:9090/nexus/content/groups/public/org/codehaus/gmaven/groovy-all/2.5.2/groovy-all-2.5.2.pom
[INFO] Downloading from : https://repo.maven.apache.org/maven2/org/codehaus/gmaven/groovy-all/2.5.2/groovy-all-2.5.2.pom
[WARNING] The POM for org.codehaus.gmaven:groovy-all:jar:2.5.2 is missing, no dependency information available
[INFO] Downloading from : http://myrepo:9090/nexus/content/groups/public/org/codehaus/gmaven/groovy-all/2.5.2/groovy-all-2.5.2.jar
[INFO] Downloading from : https://repo.maven.apache.org/maven2/org/codehaus/gmaven/groovy-all/2.5.2/groovy-all-2.5.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.816 s
[INFO] Finished at: 2018-08-30T14:25:55+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.codehaus.gmaven:groovy-all:2.5.2 or one of its dependencies could not be resolved: Could not find artifact org.codehaus.gmaven:groovy-all:jar:2.5.2 in Z-nexus-public (http://myrepo:9090/nexus/content/groups/public) -> [Help 1]
First try a forced update:
mvn clean install -U
If the forced update does not work there IS something wrong.
Check the following things:
Broken local artifacts - go to you local maven repository and search for the artifact and delete the folder. (in win usually under C:\Documents and Settings{your-username}.m2, in linux ~/.m2)
Is the artifact ACTUALLY on the repo, check spelling, version, everything!
Is the connection to the repo possible, watchout for proxy settings!

Error occured while executing shellscript during maven build

I am trying to execute a shell script in a remote linux server during a maven build.
Following are code that i used for this purpose in pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>server-copy</id>
<goals>
<goal>run</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<tasks>
<sshexec host="hostserver" username="user" trust="true"
password="password" failonerror="true" timeout="1200"
command="sh /pathofshellscript/test.sh"/>
</tasks>
</configuration>
</execution>
<executions>
Console output:
[INFO] Building test1 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.3:run (server-copy) # test1 ---
[INFO] Executing tasks
[sshexec] Connecting to hostserver:22
**Kerberos username [user109]:** user
**Kerberos password for user109:** password
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:02 min
[INFO] Finished at: 2017-06-19T14:06:27+05:30
[INFO] Final Memory: 9M/156M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (server-copy) on project test1: An Ant BuildException has occured: com.jcraft.jsch.JSchException: Auth fail -> [Help 1]
When i perform maven build , it ask for Kerberos username and password in console. I dont know why it ask for username and password since i have already provided in the pom.xml . Is there any thing that i am missing ?

Maven: Bind plugin default-cli to different phase

It's relativly simple:
I have a plugin goal tomcat7:run which i run directly in Eclipse m2e (the full command would be mvn tomcat7:run). But it runs too early (on process-classes it think), skipping the test phase. I want it to run after the test phase when invoked via cli.
I tried to simply change default-cli phase to be package instead of process-classes, but this doesn't work (phase does not change to package):
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
...
</configuration>
<executions>
<!-- Change phase, doesn't seem to change anything -->
<execution>
<id>default-cli</id>
<goals>
<goal>run</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
Running a default phase like mvn package and this execution
<execution>
<id>default-run</id>
<phase>package</phase>
</execution>
instead works but is not an option, because i don't want to execute this when creating a real package (this plugin starts up an embedded tomcat server). I'm considering profiles, but i think profiles where not made for this kind of problem.
Relevant log:
[INFO] >>> tomcat7-maven-plugin:2.3-SNAPSHOT:run (default-cli) > process-classes # gmm >>>
[INFO]
[INFO] --- frontend-maven-plugin:0.0.26:gulp (gulp build) # gmm ---
...
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # gmm ---
...
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # gmm ---
...
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.3-SNAPSHOT:run (default-cli) < process-classes # gmm <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.3-SNAPSHOT:run (default-cli) # gmm ---
... (tomcat7:run log output here) ...

How to get Cobertura to fail M2 build for low code coverage

I'm trying to configure my WAR project build to fail if the line or branch coverage is below given thresholds. I've been using the configuration provided on page 455 of the excellent book Java Power Tools, but with no success. Here's the relevant snippet of my project's Maven 2 POM:
<build>
...
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<check>
<!-- Per-class thresholds -->
<lineRate>80</lineRate>
<branchRate>80</branchRate>
<!-- Project-wide thresholds -->
<totalLineRate>90</totalLineRate>
<totalBranchRate>90</totalBranchRate>
</check>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>check</goal>
</goals>
</execution>
<execution>
<id>coverage-tests</id>
<!-- The "verify" phase occurs just before "install" -->
<phase>verify</phase>
<goals>
<goal>clean</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
<instrumentation>
<excludes>
<exclude>au/**/*Constants.*</exclude>
</excludes>
<ignores>
<ignore>au/**/*Constants.*</ignore>
</ignores>
</instrumentation>
</configuration>
</plugin>
...
</plugins>
...
</build>
As I say, the coverage report works fine, the problem is that the "install" goal isn't failing as it should if the line or branch coverage is below my specified thresholds. Does anyone have this working, and if so, what does your POM look like and which version of Cobertura and Maven are you using? I'm using Maven 2.0.9 and Cobertura 2.2.
I've tried Googling and reading the Cobertura docs, but no luck (the latter are sparse to say the least).
To my knowledge, if the <haltOnFailure> element is set to true and any of the specified checks fails, then Cobertura will cause the build to fail which is what you're asking for. But actually, this element defaults to true if you do not specify it so you don't have to add it to your configuration checks. Failing the build below any coverage threshold is (or at least should be) the default behavior.
EDIT: I did some further testing and haltOnFailure seems to be working as expected on my environment (Maven 2.2.1. and versions 2.3, 2.2, 2.1 of the plugin i.e. versions 1.9.2, 1.9, 1.8 of cobertura on Linux). I'm updating this answer with the result below.
Actually, I've added an <execution> element to my pom. I may be misinterpreting the part of cobertura:check's documentation that says it "Binds by default to the lifecycle phase: verify" but, without the <execution> element, cobertura:check wasn't triggered during the verify phase of my build. Below the setup I've use for the cobertura-maven-plugin:
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.3</version>
<configuration>
<check>
<!--<haltOnFailure>true</haltOnFailure>--><!-- optional -->
<!-- Per-class thresholds -->
<lineRate>80</lineRate>
<branchRate>80</branchRate>
<!-- Project-wide thresholds -->
<totalLineRate>90</totalLineRate>
<totalBranchRate>90</totalBranchRate>
</check>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<!--<goal>clean</goal>--><!-- works if uncommented -->
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I get the following result when running mvn clean install on a freshly generated maven project (with mvn archetype:create) patched with the plugin configuration mentioned above:
$ mvn archetype:create -DgroupId=com.mycompany.samples -DartifactId=cobertura-haltonfailure-testcase
...
$ mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building cobertura-haltonfailure-testcase
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory /home/pascal/Projects/cobertura-haltonfailure-testcase/target
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/pascal/Projects/cobertura-haltonfailure-testcase/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1 source file to /home/pascal/Projects/cobertura-haltonfailure-testcase/target/classes
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/pascal/Projects/cobertura-haltonfailure-testcase/src/test/resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Compiling 1 source file to /home/pascal/Projects/cobertura-haltonfailure-testcase/target/test-classes
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: /home/pascal/Projects/cobertura-haltonfailure-testcase/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.mycompany.samples.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.09 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] [jar:jar {execution: default-jar}]
[INFO] Building jar: /home/pascal/Projects/cobertura-haltonfailure-testcase/target/cobertura-haltonfailure-testcase-1.0-SNAPSHOT.jar
[INFO] Preparing cobertura:check
[WARNING] Removing: check from forked lifecycle, to prevent recursive invocation.
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/pascal/Projects/cobertura-haltonfailure-testcase/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [cobertura:instrument {execution: default}]
[INFO] Cobertura 1.9.2 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Instrumenting 1 file to /home/pascal/Projects/cobertura-haltonfailure-testcase/target/generated-classes/cobertura
Cobertura: Saved information on 1 classes.
Instrument time: 337ms
[INFO] Instrumentation was successful.
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/pascal/Projects/cobertura-haltonfailure-testcase/src/test/resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: /home/pascal/Projects/cobertura-haltonfailure-testcase/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.mycompany.samples.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.098 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] [cobertura:check {execution: default}]
[INFO] Cobertura 1.9.2 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 1 classes.
[ERROR] com.mycompany.samples.App failed check. Line coverage rate of 0.0% is below 80.0%
Project failed check. Total line coverage rate of 0.0% is below 90.0%
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Coverage check failed. See messages above.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18 seconds
[INFO] Finished at: Sat Oct 24 21:00:39 CEST 2009
[INFO] Final Memory: 17M/70M
[INFO] ------------------------------------------------------------------------
$
I didn't test with maven 2.0.9, but on my machine, haltOnFailure generates a BUILD ERROR and halt the build. I don't see any differences with your plugin configuration, I can't reproduce the behavior you describe.
Add the following to the <check/> configuration.
<haltOnFailure>true</haltOnFailure>
mvn clean install -Dcobertura.skip=true

Categories

Resources