How to deploy or package a maven plugin after building a maven-plugin project? - maven-2

I have done an mvn install for a custom plugin and it gave me a bunch of directories in my target directory along with a jar. I'm stuck with the next step.
How do I bundle it?
Where do I place this?
What about the pom of this plugin?
What configuration changes do I have to make and where?

You can always test it on your local machine. Just run mvn clean install and it will be installed in your local repository. Then in the project you'd like to use it from, just add the plugin to the plugins section and set it up like any other plugin. This should be enough.
If you'll be using it in your company, you'll need to be able to deploy it to a Maven repository such as Nexus or Artifactory in order for other people to be able to download it.
Deploying it is the same as for regular artifacts:
mvn clean deploy

Related

Where is GraphDB jar file?

I am trying to use a GraphDB repository from a Maven project using Eclipse Neon with builtin Maven. Where can I find the GraphDB runtime jar file to place in local Maven repository? Why GraphDB is not available from Maven Central?
update I have created a GraphDB repository and it works fine. Now I would like to setup a Maven project in Eclipse Neon to interact with the repository programmatically. GraphDB is not available from Maven central. Developer Hub instructs users to run "MVN Install" to install GraphDB runtime jar into local Maven repository. Since I am using Eclipse Neon with integrated Maven, there is no (I cannot find) MVN executable to run "MVN Install". So my question is what file(s) should I transfer manually to my local Maven repository?
The jar files that you need are the ones that are located in the installed folder of GrpahDB "app/lib". You just add them to the Build Path in eclipse and copy the Java class EmbebbedGraphDB that is in the examples folder.

How to have IntelliJ build a jar to a directory and then run a separate jar as a run config?

I am developing plugins for Spigot and I want to be able to build and run them from the same place, with the server's output going into the terminal. How do I make IntelliJ place my jar in a plugins folder and then run the server jar outside of it?
Make an artifact to build the jar to the directory and then make a run config that executes the other jar, and down at the bottom there is a list where you can have IntelliJ build the jar.

Deploy from maven released repository to application

I just figured out, how to release to CB hosted maven "release" repository. I am trying to figure out, how to deploy tagged version to CB application.
I understand, I can manually upload WAR file but is there any script. As far as I know maven plugin for CB doesn't support it.
I have one appserver is running snapshot builds from jenkins.
I have other appserver, which I want to deploy only tagged/released artifact.
There are four ways to deploy applications to the CloudBees RUN#cloud service:
Using the bees command provided by the SDK
Using the bees-maven-plugin
Using the manual upload via the web GUI
Using the CloudBees Deployer plugin for Jenkins
Which option you choose depends on where the deployment will take place from... And the from I am talking about is which machine is doing the deployment not where the file is sourced.
If running from a Jenkins job, the best bet is the Jenkins plugin.
If running from your own laptop, the web ui or the bees command is simplest.
If running as part of a maven build, the maven plugin is simplest... (Though I should warn that the maven plugin (temporarily removing my cloudbees hat and putting on my maven PMC hat) is shite and does it all arsewise ;-) )
Your best bet is to set up a Jenkins job that uses dependency:get to pull the artifact from the repo and then add a cloudbees deployer build step to push to RUN#cloud
The good news is that bashing the maven plugin into something more maven like is on our roadmap... Hopefully that will enable actions like you can achieve with the ship-maven-plugin#mojo where you can specify a specific released version for "shipping" to production.
I suppose, that what you want to do is to deploy a release artifact to your repository.
have a look at maven-release-plugin.
Briefly, what you need to do is:
$ mvn release:prepare
$ mvn release:perform
it's not so trivial, since you need to configure appropriately your pom.xml to get it working. Have a look at the maven-release-plugin examples and usage pages.
Are you creating the tag/release from a Jenkins build? If so you could probably use the Deploy to CloudBees post-build step with target/checkout/something.war.
More generally I guess you would want to write a script to use mvn dependency:get followed by the Bees SDK to obtain the latest released artifact and deploy it.

Jar discovery with IntelliJ

If I have an IntelliJ project (not maven, not gradle, not ant, there is no pom.xml, build.xml...), can I set IntelliJ to find jars in .ivy2, .gradle and .m2 repositories automatically?
It will not work from a local directory on the machine, Maven repository is required, however you can install and use a local Nexus repository. Check this blog post for more details.
You can also use the Library Finder third-party plug-in instead.

How to install a jar file from target to a specific location using maven?

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.