Local maven repository in Eclipse installation - eclipse

How can I copy a resource during Tycho build from Nexus repository so that it resides in Eclipse install directory once it's uncompressed? My end goal is to copy archived Maven repository to Eclipse install directory and use that as local Maven repository.
In our Eclipse application we use Shrinkwrap Resolver to fetch runtime jar dependencies from Nexus repository and add them to ClasspathContainer. This works well, however there will be instances when application will be running in environment that has no Internet connection. For this we need Maven repository to reside where our Eclipse application is installed - parallel to features, plugins directories; this is the best location I can think of where to host this repository.

Related

M2Eclipse: Automatically execute Maven when pom.xml changes?

For an Eclipse plugin project I need a p2 local repository to be automatically deployed with dependencies defined in the pom.
The best way (or the only way that really works) to do so is to use org.reficio plugin p2-maven-plugin.
Therefore I created a general project in Eclipse to prepare and hold the repository and a pom.xml that generates this repository.
When I execute the goal p2:site the repository is created successfully.
Now I am trying to make Eclipse with M2Eclipse to automatically execute that goal whenever the file pom.xml has ben changed (e.g. the user has added a new dependency or the file has been changed because an updated file has been downloaded from the SCM repository.
Is there a way to make M2Eclipse respectively it's Maven Project Builder to execute this phase automatically?

How to publish open source library to my nexus server with sbt

I want to publish an open source library to my own remote nexus repo. I try to change .sbt files for the library but sbt publish still tries to release using the normal sonatype nexus repo. sbt publish-local works fine for a different local project so I think that maybe I can deploy this lib without changing the .sbt files to my remote nexus.
Can I publish this lib only with added credentials in the command line?

maven - inter workspace dependencies

i am using eclipse and maven integration.
maven install puts the resources to the local repositories. local repositories is divided into "local repository" and "workspace projects" as shown in eclipse view "Maven Repositories".
The resource is unvailable to be linked by other projects of a different workspace. is there a way having "maven install" to put shnapshots to the "top" local repository available for any project?
or do i missunterstand the concept?
Workspace projects is a just a convenience feature provided by the m2e plugin where it resolves the dependencies to projects in the current workspace if the artifact specification (group id, artifact id and version) matches that of a project in the workspace. If there are no matches, m2e just uses the jar in the .m2/repo folder as the dependency.
The benefit of this feature is that you don't have to maven build and install the dependency projects continuously, your code changes are reflected immediately in the dependent project.
However, this is just a convenience feature and you can always do a maven install in a dependency project and refresh the dependent project to get the change reflected there.
TL;DR just do a usual maven install on your dependency project and refresh any workspace. It should work.

Maven dependency in Local Repository but not being picked up

The dependency I'm using is for Oracle which, reading from another post, is not included in the default maven repo due to legal issues. For this reason I've added the dependency to my local repo using:
mvn install:install-file -Dfile=/home/<myname>/development/Libraries/ojdbc6.jar
-DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar
My problem is that maven is attempting to pull the file from the default remote repo and failing although it was my understanding that the local repo is checked first.
My install of maven is the default version packaged with STS (basically Eclipse).
Kind Regards,
Justin
Checking whether the jar got properly installed in your local repository might help. If you navigate to the .m2/repository/com/oracle/ojdbc6/11.2.03/ you should find the jar present there.
if this problem is present, i can suggest you to select the Offline option on maven uptade project. Whith this option enabled, the maven install search for local repository.

Dependency and workspace projects

I have a Maven project called Utils that i'm working on. I also have another project, called A, that uses classes of Utils. So, I've added a dependency to Utils in the POM of A. I precise that the two projects are not installed in the local repository (or another private repository). When I try to package the project A, I get an error because Maven tries to get the Utils project from the local repository and central repository, but it's not there. I don't want to install the project because it's not final, i don't want to give it a version because there is no release.
Thanks
It's safe to install the project into local repository. Just use mvn install in the Utils' project folder. Anytime you do install it will be replaced by newest in your local repo.
But don't deploy it, it means others could use it. In comparison, your local repo is used only by you.
It seems that the Maven plugin on Eclipse provides this possibility. And there is no need to install the artifacts corresponding to the active projects in the local repository. It seems that the plugin considers the workspace as a second local repository (you can see this using the Maven repositories view). First, the Workspace resolution feature must be enabled (Right click on the project then under Maven). When I want to run the project, I use Run configurations wizard, and Resolve workspace must be checked.
Is it a good solution? I don't know if it just seems to work or if it really works.
Thanks