I have my Go source code, after go build, an executable is generated, which accepts some parameters to produce the output.
Is there any way build the executable from maven build with any plugins?
如何使用Maven构建GO可执行文件
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
dongzha3058 2019-04-01 12:59关注You can just put your
go buildcommand into a shell script and run it with this plugin:<plugin> <artifactId>exec-maven-plugin</artifactId> <groupId>org.codehaus.mojo</groupId> <executions> <execution> <id>Build Go binary</id> <phase>generate-sources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>${basedir}/build-golang-app.sh</executable> </configuration> </execution> </executions> </plugin>Other option is this Golang plugin which is more feature-rich and specific to this problem. However for simple use cases I would still go with Shell script.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报