I use the exec-maven-plugin as follow
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.6.0</version>
<executions>
<execution>
<id>npm install</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<executable>${npm.executable}</executable>
<arguments>
<argument>install</argument>
</arguments>
<workingDirectory>${basedir}/target/angular5/tourism</workingDirectory>
<target>
<echo message="Npm install" />
</target>
</configuration>
</execution>
</executions>
</plugin>
I have the following error
java.io.IOException: Cannot run program "npm" (in directory "/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/angular5/tourism"): error=2, No such file or directory
However the directory "/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/angular5/tourism" exists and the command npm install works in this directory in the console. I have the Apache Maven 3.5.4 installed and use eclipse
First, you should edit your question as I mentionned in comments below.
Then, I think you misunderstood the error. In fact, the error indicates that npm is not found inside your directory "/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/angular5/tourism.
And this is normal. npm is in your PATH that's why you can run npm install successfully.
I recommand you to use a Maven plugin for npm commands:
frontend-maven-plugin
npm-maven-plugin
Adding -PlocalNoDeploy as part of your mvn command might resolve this issue.
Related
In my project am using circleCI with codecov for a Springboot maven project.
Below is relevant part of the .circleci/config.yml
# run tests! and gen code coverage
- run: mvn integration-test cobertura:cobertura
- store_test_results:
path: target/surfire-reports
- run:
name: Send to CodeCov
command: bash <(curl -s https://codecov.io/bash)enter code here
And the maven plug-in is:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<check/>
</configuration>
</plugin>
And am using the default codecov.yml which can be found here.
The circleci build is successful and I do get a codecov report generated BUT the code coverage is only for files within the bootsrap package of the project com.x.y.bootstrap.
Below is an image from codecov site for the repository.
What am looking for is full code coverage of the entire project.
I believe the problem was due to the cobertura-maven-plugin not picking-up the correct source class path; hence generating the report with invalid data. I've updated the project to use jacoco-maven-plugin and simply ran the tests with:
run: mvn integration-test
The POM file change was as follows:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
Everything worth after that.
I am trying to integrate maven dockerfile plugin with my project. I have multiple modules under my maven project. I have modified the pom.xml for the module I want to build and tag images as below. Running mvn dockerfile:build command builds a creates a docker-info.jar under the target folder. I am not sure where the images are being built and when I try to run the mvn dockerfile:tag command I see the below error.
Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.4:tag
(default-cli) on project drs-web: The parameters 'repository' for goal
com.spotify:dockerfile-maven-plugin:1.4.4:tag are missing or invalid
Pom.xml:
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${docker.maven.plugin.version}</version>
<executions>
<execution>
<id>build</id>
<goals>
<goal>build</goal>
</goals>
<configuration>
<buildArgs>
<WAR_FILE>${project.build.finalName}.war</WAR_FILE>
</buildArgs>
</configuration>
</execution>
<execution>
<id>tag</id>
<goals>
<goal>tag</goal>
</goals>
<configuration>
<repository>XXX/XXX-api</repository>
<tag>${project.version}</tag>
</configuration>
</execution>
</executions>
</plugin>
Dockerfile:
FROM tomcat:9.0.10-jre8-slim
ENV CATALINA_HOME /usr/local/tomcat
MAINTAINER XXX
EXPOSE 8080
ADD target/${WAR_FILE} ${CATALINA_HOME}/webapps/XXX-api.war
To fix the error you should use the same parameters in two sections of your pom.xml. You didn't define the repository's name for the build goal:
<configuration>
<repository>XXX/XXX-api</repository>
</configuration>
The fact that docker-info.jar was created in your Target directory most likely means that the creation of the docker image completed successfully.
The image should be put to your Docker registry with the name "XXX/XXX-api", and you can check it from a console with the command:
docker image ls
P.S. You can avoid generation of docker-info.jar by adding the following parameter to the configuration section of dockerfile-maven-plugin:
<configuration>
<skipDockerInfo>true</skipDockerInfo>
</configuration>
Hi I am trying to trigger build for my Java application via JENKINS but getting following error:
An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "/export/home/buildadmin/.jenkins/jobs/HEAD/workspace/appName/wasDeploy.sh" (in directory "/export/home/buildadmin/.jenkins/jobs/HEAD/workspace/appName"): java.io.IOException: error=2, No such file or directory"
I have placed the wasDeploy.sh file in the above mentioned path but still getting the same error. Someone pleasee help me on this
did you make wasDeploy.sh executable?
You can su to the jenkins user and try to run the file manually
I have recently encountered the same problem and thought I should share my solution.
Please check the documentation, under the Description:
<property name="executable-full-path"
location="../relative/path/to/executable"/>
<exec executable="${executable-full-path}" ...
And here is how I used this solution in my pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>expand-package</id>
<phase>generate-test-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<property name="executable-full-path" location="../test" />
<exec executable="${executable-full-path}/restart_service.sh" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
Add the path to sh file of Git in System Environment variables.
The path usually is C:\Program Files\Git\bin.
I would like to find out the values of all Maven properties as they apply to some Maven project.
mvn help:system lists OS environment variables and JVM system properties, but no Maven properties.
mvn help:evaluate only works in an interactive mode, that means I have to type a single Maven property, (e.g. ${project.build.outputDirectory}) to get the value of that property.
I'm looking for a way get a full list of all Maven properties and their values.
As a workaround, add this to the <plugins> ... </plugins> section inside your project's pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echoproperties />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
Now execute mvn validate.
On the console, prefixed with [echoproperties], there will be the full list of system properties, including those set by Maven such as project.build.outputDirectory, basedir, and settings.localRepository.
the maven-help-plugin does what you want, just call it with -Dexpression=project.properties this will print the properties tag of the effective pom.
mvn help:evaluate -Dexpression=project.properties
Bonus Points when you just want the properties output and not the maven output
mvn help:evaluate -Dexpression=project.properties -q -DforceStdout
or with the explicit version because -DforceStdout works since version 3.1.0
mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.properties -q -DforceStdout
Not sure if helps, but I found this when trying to do the same thing:
mvn com.github.ekryd.echo-maven-plugin:echo-maven-plugin:echo -Decho.message='${project.build.testOutputDirectory}'
From here.
Adding the following to ${user.home}/.m2/settings.xml:
<pluginGroups>
<pluginGroup>com.github.ekryd.echo-maven-plugin</pluginGroup>
</pluginGroups>
the command can be shortened to:
mvn echo:echo -Decho.message='${project.build.testOutputDirectory}'
I don't know how to get them "officially", but here is a workaround. Add maven-antrun-plugin to your project and run mvn test -X. The plugin will show all properties passed to it from Maven. The list looks complete to me.
Actually project.build.outputDirectory is there but you need to execute in 'compile' phase, and NOT in 'validate'. I guess what properties are available also depends on the current phase for the executing goal of a particular plug-in, in this case 'maven-antrun-plugin'.
<!-- Ant Run Plugin for debugging pom.xml and calling ant tasks -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${ant.plugin.version}</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echoproperties/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
Had the same issue. Changed the timeout and maxheap in findbugs configuration through maven.
The below fixed it for me :
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<maxHeap>2048</maxHeap>
<timeout>1800000</timeout>
</configuration>
</plugin>
Currently I am debugging the signing of an Android app. And this would be a lot easier if I could just execute this one and only plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
</goals>
<phase>package</phase>
But no matter what I try all I get is:
[ERROR] Could not find goal 'signing' in plugin org.apache.maven.plugins:maven-jarsigner-plugin:1.2 among available goals verify, sign, help -> [Help 1]
org.apache.maven.plugin.MojoNotFoundException: Could not find goal 'signing' in plugin org.apache.maven.plugins:maven-jarsigner-plugin:1.2 among available goals verify,
sign, help
or
org.apache.maven.lifecycle.LifecyclePhaseNotFoundException: Unknown lifecycle phase "sign". You must specify a valid lifecycle phase or a goal in the format <plugin-pre
fix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources
, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-co
mpile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, p
ost-clean, pre-site, site, post-site, site-deploy.
or some other error.
You can run just the sign goal with this command:
mvn jarsigner:sign
I have this plugin configured is my pom like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>signer</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>target/${project.artifactId}-${project.version}.jar</archive>
<keystore>src/main/signer/.keystore</keystore>
<alias>MyCert</alias>
<storepass>password</storepass>
<keypass>password</keypass>
</configuration>
</plugin>
Because I have <archive> pointing to an artifact in my target directory I have to run a mvn clean install first, and from then on I can just execute mvn jarsigner:sign if I want to run the maven-jarsigner-plugin again to sign the jar. (I don't normally run only this plugin/goal as I just do a full "mvn clean install" all the time, but it does work.)