0

Is it possible deploy an artifact (.ear) into a application server (AS) without obtain its dependencies from a repository?

Let's me explain: the maven project I'm trying to configure for deploy into a AS has 3 modules:

  1. Web (.war - front end)
  2. EJB (.ejb - back end)
  3. Entity (.jar - entities classes)

These modules are wrapped into a EAR module and none of then are available in some repository (like Nexus or JFrog Artifactory). When I try to use Cargo Maven plugin or JBoss Deployment Maven Plugin, both notify that cannot resolve dependencies for these modules.


UPDATED (03/01/2019)

The issue is similar to that quoted in items 6 and 7 of the following link: http://webdev.jhuep.com/~jcs/ejava-javaee/coursedocs/content/html/ejb-basicex-eardeploy.html#ejb-basicex-eardeploy-testmodule

rogerio_gentil
  • 359
  • 1
  • 4
  • 17
  • 1
    You do not need to resolve dependencies to deploy an ear to an application server. The artifacts are packed into the ear. I do not know whether the plugins you mentioned require additional information that they try to gain from the artifacts (or their poms). This may be the reason. Let me add, though, that usually _all_ artifacts are in the repository, so not having the war and jar in the repository is an exception and may lead to unexpected behaviour. – J Fabian Meier Dec 28 '18 at 13:51
  • Do the EAR wrapping on a host with access to all the artifacts. After that it is a plain file and you should be able to treat it as such. – Thorbjørn Ravn Andersen Dec 28 '18 at 14:35
  • I've thought the same way @JFMeier. But the Cargo Maven Plugin notifies that the artifacts cannot be resolved, for instance, even that the `.war` and `.jar` files are packed into `.ear`. – rogerio_gentil Jan 03 '19 at 11:44
  • @rogerio_gentil We need more information. What does the log file say? – J Fabian Meier Jan 03 '19 at 12:15
  • When I execute a sample project (similar to real application) - `rm -rf ~/.m2/repository/rogeriogentil/* && mvn clean package -DskipTests && mvn -pl app-ear/ -Pdeploy cargo:deploy`, Maven produces the following log: `Failed to execute goal on project app-ear: Could not resolve dependencies for project rogeriogentil:app-ear:ear:1.0: Could not find artifact rogeriogentil:app-ejb:jar:1.0 in central (https://repo.maven.apache.org/maven2)` – rogerio_gentil Jan 03 '19 at 12:23
  • If I don't delete files in `~/.m2/repository/rogeriogentil/*` and/or execute `mvn clean install`, the deployment works fine. But if I don't delete it would be the same as using a repository. – rogerio_gentil Jan 03 '19 at 12:27

1 Answers1

0

It's a workaround but worked. Instead of the project depends on an internal repository (like Nexus or JFrog Artifactory), it's possible defines a folder as a repository on the local machine using the Maven's parameter -Dmaven.repo.local. Thus, the plugin to deploy the artifact also can use this property and obtaining the others artifacts.

That is, to build the application on the current folder:

mvn -Dmaven.repo.local=. package

To deploy the application (.ear, in this case) using Cargo Maven Plugin, for example, without depending on an internal repository:

mvn -pl app-ear/ -Dmaven.repo.local=. cargo:redeploy

OBS: Using the maven.repo.local property, the folder defined as value will be fill with all dependencies of the project. In my case, it isn't a problem because this commands are been used on a continuous integration pipeline and all files and folder are discard on the final.

rogerio_gentil
  • 359
  • 1
  • 4
  • 17