I have the following setup:
Development server for continuous build with Hudson, Maven and Artifactory up and running.
I am able to build an artifact by Maven, and let Hudson deploy it to Artifactory.
However, I would like to do the following:
Select an artifact in Artifactory on the local build server.
Deploy that artifact to a remote repository without doing a new build.
The reason I want to do that is, that the first server is a development server where new artifacts are changed at will. The other server / repository is the public visible server for all artefacts of the company.
I know that I am able to create a second build job, but that would be a duplication, and Hudson is only able to manage one Artifactory repository at one time. I could deploy that artifact by hand to a different URL, but this is error prune and I need a login on the build server and have to use the shell to do that.
Has anyone an idea how to finally reach the goal?
If I understood your question correctly it looks like a good scenario for User Plugin. It should be straightforward, you select the needed artifacts using the searches object, and then execute REST PUT call to put them on the remote server.
The Maven Stage plugin seems to support this case: http://maven.apache.org/plugins/maven-stage-plugin/usage.html
but I'm not sure if it works correctly. I'm working on it currently, so if it doesn't work perhapse I will find time to correct it.
Related
I want to create a local maven2 repository so we can download dependencies faster.
we use sbt
what is the simplest way to take all or some depedencies from http://oss.sonatype.org/content/repositories/releases and put it in our server
I was thinking of a script to download some jars and put it in a sftp server and use sftp resolver with sbt
https://github.com/harrah/xsbt/wiki/Resolvers
A pretty simple way would be to install a repository manager. A popular one is Sonatype Nexus (the application that serves http://oss.sonatype.org). The repository manager is installed on your server, and set up to proxy online Maven repositories. Then you download your dependencies from the repository manager as though it was the actual server. The first time you download a dependency, it'll be as slow as before (the proxy will download it from the internet), but after that, it'll serve its cached copy. There are some details on this question.
Currently I have a simple maven project that is building a jar file and putting it inside target/some-1.0.jar when i run mvn install.
I want to copy this file to another location when I run mvn deploy.
Currently the location is on the same machine, but it would also be great if the solution could be applied for multiple targets, some of them being on other machines (scp deployment).
What is the easiest solution to do this? I would be nice, if you could include an example too.
Details: I have few jira plugins that are compiled as jar files and I just want to be able to run a single maven command that would copy the files to the server and eventually restart the server.
mvn deploy is intended for deployment to a remote Maven repository. mvn install is used for copying to the local Maven repo (so actually, the jar is also ending up in $HOME/.m2/repository, as well as target).
I'm not sure what you're intending to do, but I suggest you look at deploying something like http://www.sonatype.org/nexus/ if you want Maven artifacts to be available to multiple machines. This will integrate nicely with the rest of Maven.
Edit: based on your updated question, it's probably best to investigate the Wagon ssh plugin, or see if there's an Ant plugin. A suitable phase would be pre-integration-test: install and deploy should be run after you've run your integration tests to check the artefact works as expected. Use profiles to distinguish the local vs. remote cases.
I am setting up an ant build system on a project with dependency resolution being managed by ivy. I have it up and running with the file system being used for the local and shared repository currently. My ultimate goal would be that when developers are fixing bugs or creating new functionality, they would only be able to put artifacts into their local repository. When they belive their code is ready to be used by the rest of the team, it would be promoted to the proper branch in SVN and the group in charge of doing official builds would compile and publish the new artifacts.
So I guess my questions are how can you control who can publish to a repository? Does ivy just rely on filesystem permissions?
Also, I would eventually like to make my shared repository available via http. I think I could point apache to the file system repository directories for retrieving artifacts, but how do you setup publishing to an http repository?
I would suggest that you setup a repository manager to manage your project's build artifacts.
The best choices are one of the following:
nexus
artifactory
archiva
Publishing to a Maven repository means that your artifacts can be consumed by projects using other build technologies. All modern build systems support Maven (Including ivy, see the ibiblio resolver).
You could specify three resolvers in your ivy settings file. First would be a chain resolver which include remote and local ivy repositories. Second would be a local resolver for local ivy repository. Third a resolver to remote ivy repository only.
Every developer retrieves artifacts using first chain resolver.
Usual developer publish artifacts using second local resolver.
Your special team could use third remote resolver to publish in remoter ivy repository.
To protect remote repository from usual developers place it on (S)FTP server with write protection by password.
The only problem in this case is how to set versions on artifacts so that artifacts published in remote repository in some cases override locally published in some not.
Our team used such scheme few years ago. But now we use only local ivy repositories and CI server to build and run tests from various branches. We came up to this after switching to git.
for existing ivy repo easy to setup this: rest-ivy
how would i get maven to deploy my app for me.
i want to be able to type
mvn deply:devserver (or something like that) and have it do the following things
SCP all dependency jars to the remote devserver/var/lib/tomcat6/shared/company folder
SCP the war file to the remote devserver/var/lib/tomcat6/webapps folder
and since i can already hear the statements/questions "why are you doing it like this, you can just build the war with dependencies in it" bla bla bla i will answer. this server is going to be running about 35 different war files (be gentle i inherited this project) all using the same dependencies so i don't see the point of having the tomcat classloader loading the same 50 or so libraries 35 times. id rather have tomcat load them on startup and share them with the webapps.
and NO, manager is not installed on this instance of tomcat so please don't go there. security guys wont let us install the management console on a publicly visible server so all the deployments must be via SCP file copies.
i could do this in about 5 minutes with ant and i havn't eliminated the possibility of simply writing a shell script to do it but i would like to give maven a chance first.
You should script the 'deploy' of the code to the server. If you choose to use Ant, do it, but Maven is not the right tool for this job.
The Maven 'deploy' goal is used to deploy built artifacts to a repository server for other projects to be able to download as dependencies. It is not the 'deploy' you are thinking of.
If you really need this done by Maven though, there is a maven ant plugin which lets you run Ant tasks in Maven and you could bind this to your deploy step. I would advise against this though because it very much goes against the conventions of using Maven as a build tool.
I would like to know weather there is a way/plugin to build a project with maven using a remote pom.xml(http://host:port/pom.xml) with out a pom.xml file in the directory where I run "mvn install".
I need this as I want to effect maven dependencies of multiple clients by making changes to one remote file hosted at (http://host:port/pom.xml).
I am not aware of a way to do this. Generally, if you are doing development with multiple developers, you should be using source control. For example, if you are using subversion, you would just make changes to the pom, commit, and the other developers can update.
Of course using a version control is absolutely necessary...It would quite helpfull to use a Maven Repository Manager to interchange the artifacts with each other simply by deploying the artifacts to a central Repository Manager in your company and furthermore it will increase the build time.
If you are on Windows, you can try mapping the remote location (possibly a network share or an FTP location) to a local drive, and then executing the maven command in your console for the mapped location. It should work.
Else, you can distribute the pom.xml file via an email and ask the users to use it as their project file.
The other option is to use a Version Control System (VCS) such as Mercurial and keeping your pom.xml stored in the repository and make it accessible for the users to checkout. So far, this is the best way to make sure everyone is using the same file.