Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add maven artifact #5

Closed
tom91136 opened this issue May 31, 2014 · 21 comments
Closed

Add maven artifact #5

tom91136 opened this issue May 31, 2014 · 21 comments
Assignees
Milestone

Comments

@tom91136
Copy link

It would be very nice to be able to add this library as a dependency.
(Though it seems hard since there's native code and I'm not sure how maven would handle that)

@kwhat
Copy link
Owner

kwhat commented Jun 1, 2014

Hi,

You can just add the jar to the class path. All of the loading and
unpacking will be handled automatically. If you have other native
dependencies you can use the java library path to combine them in a single
location. There is some additional information in the wiki here:
https://github.com/kwhat/jnativehook/wiki/How-to-build-JNativeHook-from-source#installation.
Let MD know if you have any trouble.

Best Regards,
Alex Barker
On May 31, 2014 1:58 AM, "tom91136" notifications@github.com wrote:

It would be very nice to be able to add this library as a dependency.
(Though it seems hard since there's native code and I'm not sure how maven
would handle that)


Reply to this email directly or view it on GitHub
#5.

@kwhat
Copy link
Owner

kwhat commented Aug 14, 2014

Looks like @twitwi has created a local maven repo for this lib. I will look into hosting a something in the near future. See https://github.com/twitwi/KeystrokeOSD

@RaiMan
Copy link

RaiMan commented Dec 3, 2014

How to use JNativeHook in a Maven project

Just to document the steps and Maven usage from the comment before:
(source: @twitwi - https://github.com/twitwi/KeystrokeOSD)

-- Step 1: install the JNativeHook.jar into a newly created local Maven repo

unzip ~/dl/JNativeHook-1.1.4.zip
mkdir jnativehook-local
mvn deploy:deploy-file -Durl=file://$(pwd)/jnativehook-local/ -Dfile=./JNativeHook/jar/JNativeHook.jar -DgroupId=org.jnativehook -DartifactId=JNativeHook -Dpackaging=jar -Dversion=1.1.4

You might as well deploy it to your normal Maven repo.

-- Step 2: use it as a dependency in your Maven project

<repositories>
  <repository>
    <id>project.local</id>
    <name>project</name>
    <url>file:${project.basedir}/jnativehook-local</url>
  </repository>
</repositories>
<dependencies>
  <dependency>
    <groupId>org.jnativehook</groupId>
    <artifactId>JNativeHook</artifactId>
    <version>1.1.4</version>
  </dependency>
</dependencies>

You might have to adjust the folder names/structures in both steps to your needs.
The repository spec is not needed, if you installed JNativeHook.jar into your standard local Maven repo.

@JeromSar
Copy link

@kwhat Although this is possible, this situation is not ideal at all. I think JNativeHook should be posted on the Maven central repository.

@RaiMan
Copy link

RaiMan commented Jan 25, 2015

@JeromSar and @kwhat totally agreed, that it would be great to have it on Maven Central.

@amukas
Copy link

amukas commented Feb 5, 2015

It is also possible to use it as a system dependency.

<dependency>
    <groupId>JNativeHook</groupId>
    <artifactId>JNativeHook</artifactId>
    <version>2.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/lib/JNativeHook.jar</systemPath>
</dependency>

@JeromSar
Copy link

JeromSar commented Feb 5, 2015

@amukas That works for compiling, but Maven Shade won't recognize the dependency and won't shade JNativeHook into the packaged jar. This is not ideal. :)

@kwhat
Copy link
Owner

kwhat commented Feb 5, 2015

So, I don't know very much about maven or how to add dependencies to it. If someone can give me some direction on what should happen and a link to documentation on how to do it, I'll do what I can to add support for maven.

@amukas
Copy link

amukas commented Feb 7, 2015

@JeromSar yep, you are right.
@kwhat here is one guide I've found: http://dev.solita.fi/2014/10/22/publishing-to-maven-central-repository.html, but I didn't try it by myself.

@kwhat
Copy link
Owner

kwhat commented Feb 7, 2015

Thanks for the link, I will make an attempt to add support with 2.0.1 planned for the end of Feb.

@JeromSar
Copy link

JeromSar commented Mar 8, 2015

@kwhat Bump bump :)

@kwhat
Copy link
Owner

kwhat commented Mar 10, 2015

Hey, I am a bit behind with a new Apple issue in libuiohook. It is becoming increasingly harder to support OS X 10.5 and as soon as I figure out what to do about it, I will address this issue.

@kwhat kwhat added this to the 2.0.1 milestone Mar 11, 2015
@kwhat kwhat self-assigned this Mar 11, 2015
@kwhat
Copy link
Owner

kwhat commented Mar 17, 2015

I have pushed branch 2.0-maven that has an extra ant target called deploy. Please run with ant distclean compile deploy and check the maven folder to verify output. This branch is only for testing and most of this stuff will be moved to package.xml in the cross_compile branch. Unfortunately I can't use the maven gpg deployment and signing plugin because Gentoo doesn't support maven.

@JeromSar
Copy link

@kwhat If I remember correctly, the Central Repository requires artifacts to be signed with gpg.

@kwhat
Copy link
Owner

kwhat commented Mar 17, 2015

@JeromSar I believe the accept gpg or pgp but I should currently be signing with gpg2.

@sixcorners
Copy link

The dependencies in that pom that gets generated will affect people depending on this project. Particularly that compile scoped dependency on jnitasks will also be added as a transitive compile/runtime dependency to stuff downstream. For compile time only dependencies people usually use either <optional>true</optional> or <scope>provided</scope>. Ant tasks seem closer to maven plugins though which don't get added as a <dependency>.

I don't know a whole lot about publishing to maven central or using ant but I know project lombok does it. They don't seem to have to list any dependencies. Maybe you don't either.

Here is a different guide: http://central.sonatype.org/pages/ossrh-guide.html It even links to instructions specifically for apache ant. It's made by the people who run maven central. Pretty much everything under the Producers dropdown at the top seem relevant.

By the way, if you put jnitasks into a repo you could use apache ivy to pull down that dependency instead of needing it to be downloaded manually.

@s17t
Copy link

s17t commented Apr 18, 2015

+1 for this lib in maven central

@kwhat
Copy link
Owner

kwhat commented Jun 24, 2015

Alright, this is finally moving forward but its been very slow. Its taken about a week but snapshots are now available @ https://oss.sonatype.org/content/repositories/snapshots/com/1stleg/jnativehook

As soon as I get this process down, 2.0.2 will be released here and to maven central. If you are a maven user, please provide feedback if something is wrong or unconventional.

@kwhat
Copy link
Owner

kwhat commented Jun 25, 2015

I am all ready to stage this release on Sunday (June 28, 2015) so it will probably go live on Monday for Maven central.

@kwhat kwhat modified the milestones: 2.0.2, 2.0.1 Jun 25, 2015
@JeromSar
Copy link

Thanks much @kwhat, making JNativeHook available on Maven certainly does improve the library's quality.

@kwhat
Copy link
Owner

kwhat commented Jun 30, 2015

Alright, its officially in central. If there are any issues with the pom or deployment please create a new ticket. Thanks for all the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants