Can't install package in maven - java

I want to work with some audio analysis and want to use the Phash perceptual algorithm. Here's a Java implementation I want to use.
I'm having trouble adding this project as a dependency; I don't see how to run mvn package test install to get this project linked.
Similarly, this project needs this other project to read the audio files. When I try to install the library using the cmake commands I get errors like sndfile.h: No such file or directory. This Stackoverflow answer shows how to install it, but I still get the sndfile.h: No such file or directory error. I'm on a Mac, by the way. I found the sndfile.h file and copied it to the directory, but the build didn't work in the end anyway.
I feel like this isn't the right way to do this and things should "work" after doing the basic install commands listed in the repositories. What am I missing?

Related

No output build from gradle with third-party library

I'm having trouble using gradle to build some project files from over at https://github.com/Hopding/JRPiCam. I am forcing myself to start learning gradle this week, but so far my cursory internet searches have given me only a vague sense of what gradle even does. I'm assuming that it's used to help keep track of disparate files hosted at varying locations across the internet, and maybe with file versioning. Anyways, for right now I would just like to compile a class into a Jar file and begin using it in my code to automate the camera on my raspberry Pi. The directions say to clone the directory onto my local computer, change the directory to the download location, and then, from the Windows PowerShell, use the command: ./gradlew jar to output a build directory where the compiled jars will reside. I followed the instructions, and though I received no error message, I also received no output directories. Nothing at all. I have installed gradle 6.9 on Windows 10 and made sure the path variable is set appropriately. So here is my question: 1. If I have this directory structure: , can I just cd into there and use a gradle command to compile? Thanks in advance.

How do I run dcm4che tools from command line after compilation?

I want to use the dcm2json tool, part of the dcm4che3 toolkit, but I cannot figure out how to compile and execute the command line tool. Having run
$ git clone https://github.com/dcm4che/dcm4che.git
$ cd dcm4che
$ mvn install
in the dcm4che directory root as outlined in the installation manual, all I get from compilation is a jar dcm4che/dcm4che-tool/dcm4che-tool-dcm2json/target/dcm4che-tool-dcm2json-3.3.5-SNAPSHOT.jar and a class file dcm4che/dcm4che-tool/dcm4che-tool-dcm2json/target/classes/org/dcm4che3/tool/dcm2json/Dcm2Json.class. There is no tool to execute. I can execute the standalone tools downloaded from http://sourceforge.net/projects/dcm4che/files/dcm4che3/3.3.3/ but sadly dcm2json isn't included in this (most recent sourceforge) release.
Does anyone know from where I can download a dcm2json executable or how to compile it? Any help would be really, really appreciated.
(Yes I did Google. A lot.)
dcm4che project has a sub-project called dcm4che-assembly that after running mvn install on the parent dcm4che project, produces a zip that assembles all runnable artifacts, including dcm2json.
If you are curious about how you can get the sh/bat script to run it, then dcm4che-assembly is where you have to look.
In fact, this zip assembly is the same as you download in the binary package.
Hope it helps!
I was also curious about this, so I investigated it some. I don't have a final answer, but I'll post what I've found so far in the hopes that it'll be useful to someone else, and might be the first step to an answer.
It seems that mvn install, after it does its thing, puts a whole bunch of stuff in ~/.m2. The jar files in there don't seem to run as you might expect, and based on the files in the git repo in dcm4che-assembly/src/bin, it seems they need a wrapper to run right. My preliminary toying with the wrappers doesn't seem to work—I get errors like the following:
Error: Could not find or load main class org.dcm4che3.tool.dcm2json.Dcm2Json
These wrapper files really seem to want to be installed somewhere (like /usr/local/bin?), but they do not seem to be.
On the other hand, more recent binaries are now available (currently up through 3.3.7, while git is 3.3.8-SNAPSHOT), and I'm able to use the dcm2json tool available in those. Interestingly, that executable is also a wrapper, nearly identical to the one in git. Further investigation of why it works and the one it git doesn't may lead to an answer of why the dcm4dch3 tools don't magically run after being installed.
And of course the key lies in understanding how the maven framework works.

Installing JUnit for eclipse? (Newbie)

As a newbie to programming, I am finding it really quite difficult to install all the necessary software and such to get everything running.
Up until now I have been using the command prompt and javac along with gedit to edit/compile my code, but we are meant to be using eclipse and then JUnit to test it.
I have just managed to get eclipse working, but still stuck as to how to get JUnit working.
I am stuck on the installation part...
The JUnit FAQ (http://junit.sourceforge.net/doc/faq/faq.htm#started_1) states...
Windows
To install JUnit on Windows, follow these steps:
Unzip the junit.zip distribution file to a directory referred to as %JUNIT_HOME%.
Add JUnit to the classpath:
set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar
How can you "unzip" the "junit.zip distribution file" to the directory "%JUNIT_HOME%" and how do you add something to the classpath? Where is this class path? I tried extracting the zip folder and typing "%JUNIT_HOME%" into the directory, but it says the destination path is invalid, so I assume this is not what the instructions mean.
Apologies for the noob-questions... I'm finding this technical jargon difficult to find my way around.
Any hints for the next steps for installing JUnit will also be appreciated, as I will likely get stuck on those too.
If you are using Eclipse, please import the junit.jar file to your classpath in your project. You can do it by right+click on the project and choose Properties -> Java Build Path. and add you jar file.

how to build project after code changes without mvn clean install?

I have a project in eclipse, a java app with appengine sdk and maven as my builder.
The .class files are not refreshed until i launch clean install, so every change i do in code i have to run:
mvn clean install
mvn eclipse:clean
mvn eclipse:eclipse
and then try to launch my app.
Help me please it's really annoying. Thanks
I know this is a very old post but I recently came across this issue while working with STS and Websphere application server. Hope this helps anyone to come across this ancient relic of a post.
Have a look at the "FileSync" plugin in the Eclipse marketplace. It allows to sync your workspace files with external directories (think your application server). After you install "FileSync" you can configure it to "copy/paste" your workspace files directly to your application server's exploded .war directory. It might take a little playing around with to get your files copied in a j2ee compliant format but it worked like a charm for me. Once its configured you basically just update files, save them, and your application is ready to go!
You are probably looking for a hot deployment feature. When working wit ha webapp, in most cases it is not enough just to compile a java class - usually you have to create a war package, and nearly always you have to redeploy the new code to the app server.
mvn package should be enough to create the war. You don't need to run mvn clean as long as you don't remove or rename any file. That would make things faster.
To achieve hot deployment (i.e. to get the new code instantaneously on the web-engine dev server) you need to do do some extra work, however. Make sure you use the Google Plugin for Eclipse - you can use it along with maven. The plugin at least should take care of static files hot deployment. Running the application in debug mode with Eclipse helps a bit as well as it is capable of replacing the methods' bodies on the fly.
Find further information answers to this question.
It's unclear from the question exactly what is happening and why. To figure this out, we would need to see the pom.xml and the "tree" command output showing the relevant folders and files. Then we could compare that to what the relevant maven plugin should be doing, and work from there.
As it stands, this is a quite old question in which it's unclear exactly what's happening, and OP has disappeared a long time ago. If this issue occurred today, the best thing to do would be to post to the App Engine Public Issue Tracker, although this could be inappropriate if the issue weren't in the App Engine SDK (or related maven plugins) but came from a third-party maven plugin not behaving properly (maven-compiler-plugin, for example). However, until a more in-depth analysis were performed, it would be difficult to know in advance.
Getting hot-reload of your App Engine application working is easy using only the Eclipse m2e plugin actually, and doesn't require the GPE plugin or any other special connectors:
1) Create your App Engine app as a Maven project in Eclipse as you would normally, using one of the provided Google archetypes or another custom archetype.
2) Configure your project, and do an initial build with mvn clean install in the root of the project to create the initial target/<artifact>-<version> WAR directory.
3) Start the development server with mvn appengine:devserver in the project root and ensure you can view your locally served app in a browser. Leave the development server running.
4) In Eclipse, make sure that Project -> Build automatically is checked.
Now, whenever you save a .java file Eclipse will automatically build the corresponding .class file under target/<artifact>-<version>/WEB-INF/classes. In a Maven project, this directory is set as the output directory for classes in your .classpath. The development server will detect the file change and do a hot-reload of your application so that the changes will appear immediately when you refresh your app in the browser.

Checkstyle & Findbugs Install

I have javac version 1.6.0_16 already installed on Windows XP and I'm using both Dr.Java and command prompt to compile and run Java programs.
I downloaded and extracted Checkstyle 5.5 and Findbugs 2.0.1. I'm trying to install Checkstyle and the instructions stated that I need to include checkstyle-5.5-all.jar in the classpath.
My question is, should I place the Checkstyle directory in the lib folder of the jdk1.6.0_16 directory and set the classpath as follows:
C:>set classpath=%C:\Program Files\Java\jdk1.6.0_16\lib\checkstyle-5.5\checkstyle-5.5-all.jar
Is this correct? Should I do the same for Findbugs? Thanks in advance
EDIT: When I added the above path using the environmental variables, and ran checkstyle hello.java, I got the error: 'checkstyle' is not recognized as an internal or external command, operable program or batch file
Maven will solve this problem for you
It sounds like you're just getting started in the world of Java. To that end, I'd suggest that you look into Maven for your build process. Also, you should be using at least JDK1.6.0_33 at the time of writing.
Essentially, Maven will manage the process of running Checkstyle, Findbugs (and you should also consider PMD) via standard plugins against your code. It will also manage the creation of the Javadocs, linked source code and generate a website for your project. Further, Maven promotes a good release process whereby you work against snapshots until ready to share your work to the wider world.
And if I don't use Maven?
Well, just create a /lib folder in your project and stuff your dependencies into it. Over time you will create more and more and these will get intertwined. After a while you will enter JAR Hell and turn to Maven to solve the problem.
We've all been there.

Categories