将 play 模块发布到内部 Maven 存储库

发布于 2025-01-05 08:50:46 字数 91 浏览 0 评论 0原文

我可以在本地构建 Play 框架模块并在本地使用它,但如何将其发布到内部 (Nexus) Maven 存储库(而不是公共 Play 存储库)以便 Play 能够找到它?

I can build a Play framework module locally and use it locally, but how can I publish it to an internal (Nexus) Maven repository (not the public Play repository) so that Play will be able to find it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

情绪失控 2025-01-12 08:50:46

我设法使用project/Build.scala中的以下配置将play 2.0模块构建到私有maven服务器(在我的例子中是Artificatory):

object ApplicationBuild extends Build {

    /* Stuff about your app (version,name etc) and dependencies */


    val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
          organization := "org.myorg"
    ).settings(
          publishTo := Some("My Realm" at "https://myserver.com/libs-release-local")
    ).settings(
          credentials += Credentials("My Realm", "myserver.com", "username", "password")
    )
}

然后输入

播放发布

项目目录

Edit

在Play 2.3 的

resolvers += "My Server" at "https://myserver.com/libs-release-local"

credentials += Credentials("Artifactory Realm", "myserver.com", "username", "password")

中,将以下内容添加到 build.sbt然后发布

sbt 发布

I managed to get a play 2.0 module building to a private maven server (Artificatory in my case) using the following config in project/Build.scala:

object ApplicationBuild extends Build {

    /* Stuff about your app (version,name etc) and dependencies */


    val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
          organization := "org.myorg"
    ).settings(
          publishTo := Some("My Realm" at "https://myserver.com/libs-release-local")
    ).settings(
          credentials += Credentials("My Realm", "myserver.com", "username", "password")
    )
}

Then typing

play publish

In the project dir

Edit

for Play 2.3, add following to build.sbt

resolvers += "My Server" at "https://myserver.com/libs-release-local"

credentials += Credentials("Artifactory Realm", "myserver.com", "username", "password")

Then issue

sbt publish

压抑⊿情绪 2025-01-12 08:50:46

所以事实证明,有一个整堆 对此的不同解决方案。 Play 文档中甚至隐藏了一个提示,但据报道它略有不正确。

我最终使用的解决方案是将发布任务添加到使用 ivy 的 build.xml 中,并编写一个 ivy.xml 文件,将工件文件类型设置为 和文件扩展名zip

So it turns out there's a whole bunch of different solutions to this. There's even a hint tucked away in the Play documentation, but it's reportedly slightly incorrect.

The solution I ended up using was adding a publish task to build.xml which uses ivy, and writing an ivy.xml file that set the artifact file type to bundle and the file extension to zip.

半世晨晓 2025-01-12 08:50:46

我自己不了解 Play 框架,但通常你有两个选择。 Play 包含自己的 Maven 构建吗?如果是这样,您可以将分发管理设置配置到 Play 框架的 pom.xml 中,然后仅使用“mvn deploy”。只需按照以下 maven 部署插件文档中的说明配置 Nexus:

http:// maven.apache.org/plugins/maven-deploy-plugin/usage.html

如果 Play 框架没有 Maven 构建,您可以为您的 jar 使用“deploy:deploy-file”目标想要手动部署到 Nexus。

我记得一开始获取部署文件命令的所有必要参数有点棘手。要有耐心 :)

I don't know Play framework myself, but normally you have two options. Does Play contain its own Maven build? If so, you can configure distribution management settings to the Play framework's pom.xml and just use "mvn deploy". Just configure Nexus like explained in the following maven deploy plugin doc:

http://maven.apache.org/plugins/maven-deploy-plugin/usage.html

If there's no Maven build for Play framework, you can use the "deploy:deploy-file" target for the jars you want to deploy manually to Nexus.

I remember it's a bit tricky at first to get all the necessary parameters for the deploy-file command. Be patient :)

卸妝后依然美 2025-01-12 08:50:46

在脚本中,您可以使用此命令将工件推送到 nexus 存储库,用户必须有权在 nexus 上推送工件

curl --request POST --user user:passwd http://mynexus/nexus/content/repositories/releases/com/myorg/$APPLICATION/$VERSION/$APPLICATION-$VERSION.zip -F "file=@dist/$APPLICATION-$VERSION.zip"  --verbose

In a script you can use this command to push an artifact to a nexus repository, the user must have the right to push artifacts on nexus

curl --request POST --user user:passwd http://mynexus/nexus/content/repositories/releases/com/myorg/$APPLICATION/$VERSION/$APPLICATION-$VERSION.zip -F "file=@dist/$APPLICATION-$VERSION.zip"  --verbose
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文