{"id":13413698,"url":"https://github.com/raydac/mvn-golang","last_synced_at":"2025-08-20T02:32:26.508Z","repository":{"id":48295579,"uuid":"54620819","full_name":"raydac/mvn-golang","owner":"raydac","description":"maven plugin to automate GoSDK load and build of projects","archived":true,"fork":false,"pushed_at":"2025-03-03T11:37:33.000Z","size":105408,"stargazers_count":165,"open_issues_count":4,"forks_count":31,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-07-27T06:17:14.114Z","etag":null,"topics":["golang","java","maven-plugin","mojo"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raydac.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-24T06:47:08.000Z","updated_at":"2025-03-03T15:52:58.000Z","dependencies_parsed_at":"2023-02-17T11:31:14.821Z","dependency_job_id":"b46576f4-008b-475c-9638-9880adc68eae","html_url":"https://github.com/raydac/mvn-golang","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/raydac/mvn-golang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raydac%2Fmvn-golang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raydac%2Fmvn-golang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raydac%2Fmvn-golang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raydac%2Fmvn-golang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raydac","download_url":"https://codeload.github.com/raydac/mvn-golang/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raydac%2Fmvn-golang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271254631,"owners_count":24727376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","java","maven-plugin","mojo"],"created_at":"2024-07-30T20:01:46.741Z","updated_at":"2025-08-20T02:32:26.499Z","avatar_url":"https://github.com/raydac.png","language":"Java","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=AHWJHJFBAWGL2"],"categories":["Go语言包管理","包管理","Package Management","Relational Databases"],"sub_categories":["OpenGL","HTTP客户端","HTTP Clients","ORM"],"readme":"![mvn-golang](assets/git_banner.png)\n\n\u003e [!WARNING]  \n\u003e I have archived this project because Golang has changed significantly since 2016, making maintenance too complex and costly. I am sure that Go's build process will continue to evolve, so I have started a lightweight alternative: [gosdk-wrapper-maven-plugin](https://github.com/raydac/gosdk-wrapper-maven-plugin). This new plugin is designed to provide a highly flexible mechanism that remains compatible with future changes and focuses solely on downloading GoSDK and invoking its tools. \n\n[![License Apache 2.0](https://img.shields.io/badge/license-Apache%20License%202.0-green.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n[![Java 8.0+](https://img.shields.io/badge/java-8.0%2b-green.svg)](http://www.oracle.com/technetwork/java/javase/downloads/index.html)\n[![Maven central](https://maven-badges.herokuapp.com/maven-central/com.igormaznitsa/mvn-golang-wrapper/badge.svg)](http://search.maven.org/#artifactdetails|com.igormaznitsa|mvn-golang-wrapper|2.3.10|jar)\n[![Maven 3.0.3+](https://img.shields.io/badge/maven-3.0.3%2b-green.svg)](https://maven.apache.org/)\n[![PayPal donation](https://img.shields.io/badge/donation-PayPal-cyan.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=AHWJHJFBAWGL2)\n[![YooMoney donation](https://img.shields.io/badge/donation-Yoo.money-blue.svg)](https://yoomoney.ru/to/41001158080699)\n\n# Changelog\n\n__ARCHIVED (03-mar-2025)__\n\n__2.3.10 (08-jun-2022)__\n\n- updated dependencies\n- default GoSDK version is 1.19\n\n__2.3.9 (04-jul-2021)__\n\n- fix for clean fail for multi-module project if some artifacts\n  unresolvable [#90](https://github.com/raydac/mvn-golang/issues/90)\n- fix for seldom error \"Can't create temp folder\" when building modules\n  concurrently [#88](https://github.com/raydac/mvn-golang/issues/88)\n- default GoSDK version is 1.16.5\n- added autodetect for aarch64 [#87](https://github.com/raydac/mvn-golang/issues/87)\n\n[full changelog](https://github.com/raydac/mvn-golang/blob/master/CHANGELOG.md)\n\n# GO start!\n__Taste Go in just two commands!__\n```\nmvn archetype:generate -B -DarchetypeGroupId=com.igormaznitsa -DarchetypeArtifactId=mvn-golang-hello -DarchetypeVersion=2.3.10 -DgroupId=com.go.test -DartifactId=gohello -Dversion=1.0-SNAPSHOT\nmvn -f ./gohello/pom.xml package\n```\nThe First command in th snippet above generates a maven project with some test files and the second command builds the project.\n[Also you can take a look at the example `Hello world` project using the plugin](https://github.com/raydac/mvn-golang-example)\n\nIf you want to generate a multi-module project, then you can use such snippet\n```\nmvn archetype:generate -B -DarchetypeGroupId=com.igormaznitsa -DarchetypeArtifactId=mvn-golang-hello-multi -DarchetypeVersion=2.3.10 -DgroupId=com.go.test -DartifactId=gohello-multi -Dversion=1.0-SNAPSHOT\n```\n\n# Introduction\nThe Plug-in just wraps Golang tool-chain and allows to use strong maven based infrastructure to build Golang projects. It also can automatically download needed Golang SDK from the main server and tune needed version of packets for their branch, tag or revisions.\nBecause a Golang project in the case is formed as just maven project, it is possible to work with it in any Java IDE which supports Maven.\n![mvn-golang-wrapper](https://raw.githubusercontent.com/raydac/mvn-golang/master/assets/doc_common.png)\n\n# How it works\nOn start the plug-in makes below steps:\n- analyzing the current platform to generate needed distributive name (it can be defined directly through properties)\n- check that needed Golang SDK is already cached, if it is not cached then needed SDK will be loaded and unpacked from the main Golang SDK site\n- execute needed go lang tool `bin/go` with defined command, the source folder will be set as current folder\n- all folders of the project which are visible for maven (source folder, test folder, resource folders and test resource folders) are archived in ZIP file and the file is saved as a maven artifact into local maven repository (or remote maven repository). The generated ZIP artifact also contains information about dependencies which can be recognized by the plugin. In opposite to Java, Golang produces platform-dependent artifacts so that it doesn't make sense to share them through maven central but only resources and sources.  \n\n# How to build\nBecause it is maven plugin, to build the plugin just use\n```\nmvn clean install -Pplugin\n```\nTo save time, examples excluded from the main build process and activated through special profile\n```\nmvn clean install -Pexamples\n```\n# Important note about automatic Golang SDK load\nIf you have some problems with certificates during Golang SDK load, then just add `\u003cdisableSSLcheck\u003etrue\u003c/disableSSLcheck\u003e` into plugin configuration to ignore check of certificates (also you can use property 'mvn.golang.disable.ssl.check'). Also it allows property `mvn.golang.disable.ssl.check` to disable SSL certificate check during network actions.\n\n# How to add the plugin into maven project?\nBelow described build section for simple golang project which keeps source in `src` forlder and result should be placed into `bin` folder. Because it is golang project and mvn-golang plugin provides its own lifecycle, packaging for the project should be `\u003cpackaging\u003emvn-golang\u003c/packaging\u003e`\n\n```xml\n\u003cbuild\u003e\n    \u003c!--Changing standard Maven project source structure to make it Go compatible--\u003e\n    \u003csourceDirectory\u003e${basedir}${file.separator}src\u003c/sourceDirectory\u003e\n    \u003cdirectory\u003e${basedir}${file.separator}bin\u003c/directory\u003e\n\n    \u003cplugins\u003e\n      \u003cplugin\u003e\n        \u003cgroupId\u003ecom.igormaznitsa\u003c/groupId\u003e\n        \u003cartifactId\u003emvn-golang-wrapper\u003c/artifactId\u003e\n        \u003cversion\u003e2.3.10\u003c/version\u003e\n        \u003cextensions\u003etrue\u003c/extensions\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003erun\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n              \u003cpackages\u003e\n                \u003cpackage\u003emain.go\u003c/package\u003e\n              \u003c/packages\u003e\n            \u003c/configuration\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n      \u003c/plugin\u003e\n    \u003c/plugins\u003e\n\u003c/build\u003e\n```\n# Work with dependencies\n\n## Dependencies from Maven repository (since 2.3.0)\n\nPlugin supports work with maven repository and can install and load dependencies from there. Artifacts generated by the plugin saved in maven respository as zip archives and `mvn-golang` must be used as `type`.\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.igormaznitsa\u003c/groupId\u003e\n  \u003cartifactId\u003emvn-go-test-lib\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\n  \u003ctype\u003emvn-golang\u003c/type\u003e\n\u003c/dependency\u003e\n\n```\nPlugin makes some trick in work with Maven Golang dependencies, it downloads Golang artifacts from repository and unpack them into temporary folder, then all unpacked dependencies are added to `$GOPATH`. You can take a look at [example project which has two level dependency hierarchy](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-maven-repository).\nDependency mechanism is enabled by default for all goals which need it, but it can be off with `\u003cscanDependencies\u003efalse\u003c/scanDependencies\u003e`. If there is any conflicts or errors in Golang for Go modules then you can turn off Go modules with\n```xml\n\u003cenv\u003e\n  \u003cGO111MODULE\u003eoff\u003c/GO111MODULE\u003e\n\u003c/env\u003e\n```\n__Keep in mind that it is impossible use links to Github and Bitbucket libraries through `\u003cdependencies\u003e` maven mechanism, links to such dependencies should be processed by standard `GET` command and information about it you can find below.__\n\n## Support of Module mode\n\nSince 2.3.3 version, plug-in supports Golang module mode and allows to mix modules and work with golang maven dependencies, [I have made some sample to show the possibility](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-maven-module-mix). By default support of module mode is turned off, but it can be turned on through `\u003cmoduleMode\u003etrue\u003c/moduleMode\u003e` or property `mvn.golang.module.mode`.\n\n## Wrapped GET command\n\nPlugin provides wrapper for Golang GET command and you can just define some external file contains package info through\nsystem property `mvn.golang.get.packages.file`, the file will be loaded and parsed and its definitions will be added\ninto package dependencies. Format of the file is very easy. Each package described on a line in\nformat `package: \u003cPACKAGE_NAME\u003e[,branch: \u003cBRANCH\u003e][,tag: \u003cTAG\u003e][,revision: \u003cREVISION\u003e]` also it supports single line\ncomments through `//` and directive `#include \u003cFILE_NAME\u003e` to load packages from some external file. Also it supports\ninterpolation of properties defined in format `${property.name}` and provide access to maven, system and environment\nvariables.   \nExample:\n\n```\n// example package file\n#include \"${basedir}/external/file.txt\"\npackage:github.com/maruel/panicparse,tag:v1.0.2 // added because latest changes in panicparse is incompatible with termui\npackage:github.com/gizak/termui,branch:v2\n```\n\nThis mechanism just makes work with dependencies easier and if you want to provide some specific flags and scripts to\nprocess CVS folders you have to define configuration parameters in pom.xml, packages defined in the external file and in\nthe pom.xml will be mixed.\n\nThe Plug-in doesn't work with standard maven dependencies and they must be defined through task of the plugin, the\nexample of easiest case of dependencies is\n```xml\n\u003cexecution\u003e\n   \u003cid\u003edefault-get\u003c/id\u003e\n   \u003cconfiguration\u003e\n     \u003cpackages\u003e\n       \u003cpackage\u003egithub.com/gizak/termui\u003c/package\u003e\n       \u003cpackage\u003egithub.com/kataras/iris\u003c/package\u003e\n     \u003c/packages\u003e\n   \u003c/configuration\u003e\n\u003c/execution\u003e\n```\nit will be executed as `bin/go get github.com/gizak/termui github.com/kataras/iris`\n\nIf you want work with specific branch then use below snipet\n```xml\n\u003cexecution\u003e\n  \u003cid\u003edefault-get\u003c/id\u003e\n  \u003cconfiguration\u003e\n    \u003cbuildFlags\u003e\n    \u003cflag\u003e-u\u003c/flag\u003e\n    \u003c/buildFlags\u003e\n    \u003cpackages\u003e\n      \u003cpackage\u003egithub.com/gizak/termui\u003c/package\u003e\n    \u003c/packages\u003e\n    \u003cbranch\u003ev2\u003c/branch\u003e\n  \u003c/configuration\u003e\n\u003c/execution\u003e\n```\nif you want to have several dependencies with different tag and branch then take a look at the snipet below\n```xml\n\u003cexecution\u003e\n  \u003cid\u003edependency1\u003c/id\u003e\n  \u003cgoals\u003e\n    \u003cgoal\u003eget\u003c/goal\u003e\n  \u003c/goals\u003e\n  \u003cconfiguration\u003e\n    \u003cpackages\u003e\n      \u003cpackage\u003egithub.com/some/framework\u003c/package\u003e\n    \u003c/packages\u003e\n    \u003ctag\u003e1.0.1\u003c/tag\u003e\n  \u003c/configuration\u003e\n\u003c/execution\u003e\n\u003cexecution\u003e\n  \u003cid\u003edependency2\u003c/id\u003e\n  \u003cgoals\u003e\n    \u003cgoal\u003eget\u003c/goal\u003e\n  \u003c/goals\u003e\n  \u003cconfiguration\u003e\n    \u003cpackages\u003e\n      \u003cpackage\u003egithub.com/some/another\u003c/package\u003e\n    \u003c/packages\u003e\n    \u003cbranch\u003ev2\u003c/branch\u003e\n  \u003c/configuration\u003e\n\u003c/execution\u003e\n```\nsometime GIT can produce cache errors and in the case you can try to turn on auto-fix of such errors with `\u003cautofixGitCache\u003etrue\u003c/autofixGitCache\u003e` flag.   \n\n# How to save generated artifact in repository?\nBy default, artifact will be installed into maven repository automatically during `install` phase if you want to turn off artifact installation then you can use standard maven properties\n```xml\n\u003cproperties\u003e\n    \u003cmaven.install.skip\u003etrue\u003c/maven.install.skip\u003e\n    \u003cmaven.deploy.skip\u003etrue\u003c/maven.deploy.skip\u003e\n\u003c/properties\u003e\n```\nor disable plugin mojo execution\n```xml\n\u003cexecution\u003e\n  \u003cid\u003edefault-mvninstall\u003c/id\u003e\n  \u003cphase\u003enone\u003c/phase\u003e\n\u003c/execution\u003e\n```\n\n# Configuration\n\nAbout configuration parameters, you can read at [the wiki page](https://github.com/raydac/mvn-golang/wiki/PluginConfigParameters).\n\n# Testing\nThe Wrapper just wraps calls to Go tool and recognize the exit code, if call of `go test` is non-zero then build will be failed, it doesn't make any analysing of test reports!   \nSometime it is useful to use [GoConvey](https://github.com/smartystreets/goconvey) tool for testing, in the case use snippet below to add dependency and make testing verbose\n```xml\n\u003cexecution\u003e\n  \u003cid\u003edefault-get\u003c/id\u003e\n  \u003cconfiguration\u003e\n    \u003cbuildFlags\u003e\n      \u003cflag\u003e-u\u003c/flag\u003e\n    \u003c/buildFlags\u003e\n    \u003cpackages\u003e\n      \u003cpackage\u003egithub.com/smartystreets/goconvey\u003c/package\u003e\n    \u003c/packages\u003e\n  \u003c/configuration\u003e\n\u003c/execution\u003e\n\u003cexecution\u003e\n  \u003cid\u003edefault-test\u003c/id\u003e\n  \u003cconfiguration\u003e\n    \u003cbuildFlags\u003e\n      \u003cflag\u003e-v\u003c/flag\u003e\n    \u003c/buildFlags\u003e\n  \u003c/configuration\u003e\n\u003c/execution\u003e                    \n```\n\n# Some Examples\n- __[Protobuf use example](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-protobuf)__\n- __[Maven repository dependencies example](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-maven-repository)__\n - __[Maven repository dependencies together with modules example](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-maven-module-mix)__\n - __[Versioning of dependencies](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/test-git-cvs)__\n - __[\"Hello world!\" console application.](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-helloworld)__\n - __[Console application with embedded text resource prepared with the `go-bindata` utility.](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-genbindata)__\n - __[Console application with `termui` library (it needs installation of some native libraries!).](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-termui)__\n - __[NES emulator.](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-nes)__\n - __[ANTLR usage.](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-antlr)__\n - __[Multimodule project.](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-multimodule)__\n - __[Preprocessing.](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-preprocessing)__\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraydac%2Fmvn-golang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraydac%2Fmvn-golang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraydac%2Fmvn-golang/lists"}