Java 有没有一种方法可以将公共jarurl作为maven依赖项包括在内?

Java 有没有一种方法可以将公共jarurl作为maven依赖项包括在内?,java,maven,Java,Maven,我有一个jar文件,它是我在s3上公开托管的。我想把它包括在另一个Maven Java项目中 我可以将其作为依赖项包含在pom.xml中吗?如果文件结构遵循maven文件夹结构,则只需指定 <repositories> <repository> <id>example-repo</id> <url>https://your_website/path</url&

我有一个jar文件,它是我在s3上公开托管的。我想把它包括在另一个Maven Java项目中


我可以将其作为依赖项包含在pom.xml中吗?

如果文件结构遵循maven文件夹结构,则只需指定

    <repositories>
        <repository>
            <id>example-repo</id>
            <url>https://your_website/path</url>
        </repository>
    </repositories>
如果您只想链接jar,那么需要使用下载插件将jar下载到lib文件夹

<plugin>
    <groupId>com.googlecode.maven-download-plugin</groupId>
    <artifactId>download-maven-plugin</artifactId>
    <version>1.4.2</version>
    <executions>
        <execution>
            <id>install-jbpm</id>
            <phase>compile</phase>
            <goals>
                <goal>wget</goal>
            </goals>
            <configuration>
                <url>http://path_to_your_jar</url>
                <outputDirectory>${project.build.directory}
            </configuration>
        </execution>
    </executions>
</plugin>
然后引用

 <dependency>
    <groupId>com.sample</groupId>
    <artifactId>sample</artifactId>
    <version>1.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/yourJar.jar</systemPath>
</dependency>
com.xxx.xxx 示例应用程序 1 系统 ${basedir}/lib/yourJar.jar
最好像开源项目一样加入mvnrepository,这样每个人都可以看到它。另一个选择是在AmazonS3中维护Nexus,并发布jar文件,以便在其他项目中使用?也许这对TL有帮助;最好把它放在一个盒子里repo@FedericoklezCulloca我确实看了那个链接。问题是一样的,但答案没有帮助,因为它没有帮助原作者either@Sambit你能分享一个关于如何在s3中运行nexus的示例URL吗?检查这个链接,你能给出示例吗?实际上我只有一个jar文件。它不遵循maven文件夹结构。那么你可能需要一个下载插件,比如:然后你可以使用下面清飞苑提供的代码向本地jar添加依赖项