我想做的是:
-
在我的scala sbt项目中,我想将一个工件发布到
地方的
Maven存储库
-
之后,我想在基于分级的Java项目中使用这个工件。
这就是我奋斗的地方:
-
我已经成功地发布了工件
sbt publishM2
. 这是我的
build.sbt
:
organization := "com.example"
name := "my.messaging"
version := "0.1"
scalaVersion := "2.12.8"
publishMavenStyle := true
这将在此处生成工件:
C:\Users\BAIERLF\.m2\repository\com\example\my-messaging_2.12\0.1
POM文件如下所示:
<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-messaging_2.12</artifactId>
<packaging>jar</packaging>
<description>my.messaging</description>
<version>0.1</version>
<name>my.messaging</name>
<organization>
<name>com.example</name>
</organization>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.12.8</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>ArtimaMavenRepository</id>
<name>Artima Maven Repository</name>
<url>http://repo.artima.com/releases/</url>
<layout>default</layout>
</repository>
</repositories>
</project>
我发现自己无法在我的研究生项目中成功地使用这个工件。这就是我试图链接它的方式:
dependencies {
compile group: 'com.example', name: 'my-messaging_2.12', version: '0.1'
}
我觉得我在这里做了很多错事,但如果有人能给我一个提示,那就太好了。
编辑:
我用稍微不同的结果再试了一次,所以我更新了我的答案。