I have a server project consisting of a few Maven Modules. I was now about to create another one that is supposed to contain objects that the server and any (Java) client shares. It appears that due to the Maven dependency it expects me to deliver a .jar
file.
In my pom.xml
I'm getting:
Missing artifact com.server:shared:jar:0.0.1-SNAPSHOT
How can I tell Eclipse to either create a .jar
file and copy it where it is needed or that it should at least rely on the source code?
My project structure:
server (parent)
- server-data-model (maven-archetype-quickstart)
- server-web (maven-archetype-webapp)
- server-mobile (maven-archetype-webapp)
- server-shared (maven-archetype-quickstart)
server-web
and server-mobile
are just providing a REST API and what I want to do is to create a jar
file from server-shared
for the server projects and another client project to share. It contains basically simple POJO objects (return values from the server a client is supposedto receive).
From stackoverflow answer:
Install the JAR into your local Maven repository as follows:
mvn install:install-file
-Dfile=<path-to-file>
-DgroupId=<group-id>
-DartifactId=<artifact-id>
-Dversion=<version>
-Dpackaging=<packaging>
-DgeneratePom=true
Where: <path-to-file> the path to the file to load
<group-id> the group that the file should be registered under
<artifact-id> the artifact name for the file
<version> the version of the file
<packaging> the packaging of the file e.g. jar
UPDATE
Using maven it is very simple.
Just add the dependency in server-web
and server-mobile
like below.
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>server-shared</artifactId>
<version>${project.version}</version>
</dependency>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.