catalog
catalog copied to clipboard
maven multi module project not work(unrecognized option: -pl)
Expected Behavior
Multi-module maven projects(with -pl option) should work
mvn -DskipTests package -pl common,mobile-bff
Actual Behavior
Not work, throws exception: Unable to parse command line options: Unrecognized option: -pl common,mobile-bff
step-mvn-settings
using existing /workspace/maven-settings/settings.xml
step-mvn-goals
Unable to parse command line options: Unrecognized option: -pl common,mobile-bff
usage: mvn [options] [<goal(s)>] [<phase(s)>]
Steps to Reproduce the Problem
Tekton maven does not recognize maven -pl option, it throws error, but this works fine in my local environment.
Additional Info
Snippet of my pipeline.yaml
- name: build
taskRef:
name: maven
kind: ClusterTask
runAfter:
- fetch-repository
params:
- name: CONTEXT_DIR
value: $(params.CONTEXT_PATH)
- name: GOALS
value:
- -B
- -Dmaven.repo.local=$(workspaces.maven-settings.path)
- -DskipTests
- -pl common,$(params.APP_NAME)
- package
workspaces:
- name: maven-settings
workspace: local-maven-repo
- name: source
workspace: source
This is a snippet of my parent pom.
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>17</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<spring-cloud.version>2023.0.1</spring-cloud.version>
</properties>
<modules>
<module>common</module>
<module>mobile-bff</module>
<module>web-bff</module>
</modules>
It works on my local environment.
$ mvn -DskipTests package -pl common,mobile-bff
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] bff-common [jar]
[INFO] mobile-bff [jar]
[INFO]
[INFO] ----------------------< com.ibm.smbc:bff-common >-----------------------
[INFO] Building bff-common 0.0.1-SNAPSHOT [1/2]
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
...
[INFO] Reactor Summary for bff-common 0.0.1-SNAPSHOT:
[INFO]
[INFO] bff-common ......................................... SUCCESS [ 1.609 s]
[INFO] mobile-bff ......................................... SUCCESS [ 0.527 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.442 s
[INFO] Finished at: 2024-05-03T22:42:23+08:00
[INFO] ------------------------------------------------------------------------