Thursday, January 18, 2018

how to create Golang project with maven archetype

I have made small GIF which shows how to make a GoLang project with maven archetype and build it
mvn archetype:generate -B -DarchetypeGroupId=com.igormaznitsa -DarchetypeArtifactId=mvn-golang-hello -DgroupId=HiGo -DartifactId=hello

2 comments:

  1. Hi Igor,
    a question about mvn-golang-wrapper plugin.
    I tried to add flags to the build phase, adding this snip to the maven project:

    default-build


    -a
    -ldflags '-extldflags -static'




    but mvn clean install fails with the error:
    [INFO] Prepared command line : bin/go build -buildmode=default -o /disk/SecuritySandbox/security-sandbox/hashicorp/mkms/mkms-exe/bin/mkms -a -ldflags '-extldflags -static'
    [ERROR]
    [ERROR] ---------Exec.Err---------
    [ERROR] flag provided but not defined: -ldflags '-extldflags -static'

    Do you know if there is a workaround to solve this?

    Best Regards,
    Giampiero

    ReplyDelete
    Replies
    1. Hi Giampiero
      it is better to send such questions through github because blogspot works not well with codesnipets but if shortly there is special section ldFlags for the build goal where you should place your parameters, like
      <ldFlags>
      <ldFlag>-extldflags</ldFlag>
      <ldFlag>-static</ldFlag>
      </ldFlags>

      Delete