Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maven multi module project not work(unrecognized option: -pl) #1256

Open
uniquejava opened this issue May 3, 2024 · 0 comments
Open

maven multi module project not work(unrecognized option: -pl) #1256

uniquejava opened this issue May 3, 2024 · 0 comments

Comments

@uniquejava
Copy link

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

image
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.

image

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] ------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant