Add ical4j to a maven jhipster project - java

I have a jhipster generated application using maven with java springboot on the backend. I want to add the ical4j library to the project so under the <dependencies> tag in the pom.xml file I added the lines like explained here . However when I add import org.mnode.ical4j; the maven compiler throws an error package org.mnode does not exist .
This seems pretty trivial but I don't get what I am missing.
Thank you

From what I can see in the official GitHub repo (ical4j/ical4j) the correct package to import starts from net.fortuna.ical4j. Example:
import net.fortuna.ical4j.util.DefaultEncoderFactory;

Related

How to import & use github repos in Android Studio

I've spent hours trying to import/use a custom github repo for an android app and am having no luck. I'm new to Android Studio but can't seem to import the repo such that I can use its methods. I've tried a lot of recommendations from here and the wider web without success. Probably because the posts I have come across are 5+ years old...
Have tried adding the following to to build.gradle (:app), but I get an error "Failed to resolve: com.github.pkleczko:CustomGauge:1.0.4":
implementation 'com.github.pkleczko:CustomGauge:1.0.4'
Have tried adding the the following to the above, but this gives me the error "Build was configured to prefer settings repositories over project repositories but repository 'MavenRepo' was added by build file 'app\build.gradle'":
repositories {
mavenCentral()
}
Have tried using New -> Import Module and New -> Project from Version Control per this, but these just opened the repo in a new window.
Having CustomGuage as a dependency for my app module didn't seem to do anything either.
It shouldn't be this hard, should it?! Please help, what am I doing wrong?! Do I need to import the project and then refactor it for my needs rather than using it as a 'library'? Do I need to add an import statement to my java file?
Thank you!
This is an old project. You can see his warehouse introduction. He uploaded it in jcenter. Of course, mavenCentral will not.
this is repository -> pkleczko/CustomGauge

How to import Thrift into Java program?

I’m writing a Java-programm for school that also uses Thrift.
The problem is not so much the general programm/programm-logic itself, but just importing Thrift (to use it in a specific part).
My basic -possibly wrong- understanding is that you write the programm-code (here empfaenger.java), then you import Thrift into this file by adding the needed import-statements, e.g.:
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket ;
import org.apache.thrift.transport.TTransport;
and adding a file in the same directory from which they can actually can be imported, in this case libthrift-0.13.0.jar.(1) Then you later also import a compiled .thrift-file with the language-specific realization oft he IDL-code, that iself again imports some Thrift-classes. This file is here named syncautohersteller.
EDIT: The approach with the .jar-file was recommended by the prof.
Current project-structure (as seen in InteliJ):
The problem is now just that all the Thrift import-statements all throw errors, e.g.
empfaenger.java
java: package org.apache.thrift does not exist
syncautohersteller
package javax.annotation does not exist
so clearly i’m doing something wrong.
Does anybody know how to fix this?
(1) I got the file from the Thrift folder (Home/Downloads/thrift-0.13.0/lib/java/build/libs and then the first of the three .jar-files in the folder) after installing Thrift using ./configure, sudo make and sudo make install and trying to verify by running “~/Downloads/thrift-0.13.0$ thrift –version” with result
Thrift version 0.13.0
In IntellJ Idea to add external Jars you can find some useful information in this question: Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project.
I suggest you to manage the project's dependencies through Maven, which help you to add JAR dependencies to the classpath in a simpler way.
First, you have to convert your project into a Maven project as explained in IntelliJ Idea documentation.
Then you can follow these steps:
Go to Maven repository website
Search for Thrift
Select first result
Select the version you need
Copy the maven dependency
org.apache.thrift
libthrift
0.13.0
Add maven dependency to your pom.xml file
Execute a mvn clean install, after clicking the following button in IntelliJ
This process will help you and people which work with you to manage in a simpler way the dependencies of the project.
You can do it the simplest way with the Gradle, something like this:
build.gradle.kts:
repositories {
mavenCentral()
}
dependencies {
implementation("org.apache.thrift:libthrift:0.13.0")
}

Cannot resolve dependencies in sample Google VR Project

I cloned the project from here git clone https://github.com/googlevr/gvr-android-sdk.git
I imported the gvr-android-sdk project into Android Studio:
Opening the buid.gradle for the samples-sdk-treasurehunt project I see the following dependencies:
dependencies {
compile 'com.google.vr:sdk-audio:1.60.1'
compile 'com.google.vr:sdk-base:1.60.1'
}
See image here:
What am I missing?
If you take a look at https://bintray.com/google/googlevr/sdk-audio
It shows that version 1.60.1 hasn't been pushed to the repository yet. Try setting the versions to 1.60.0 (the latest pushed version)
edit: you may have imported the wrong folder, you need to import the folder that you cloned the repository to (as you need to project-level build.gradle), instead of import gvr-treasurehunt import gvr-android-sdk
Subscribe to the recently create issue at https://github.com/googlevr/gvr-android-sdk/issues/431 where I've added an initial solution (change ALL dependency references to 1.60.1 to 1.60.0, not just for the sample you're building.

Understanding JIRA dependencies and package imports

I'm relatively new to JIRA plugin development and as I'm working through various tutorials I've run into a problem where I can only import certain JIRA java classes. For instance, when trying to compile this tutorial to create a custom search request view https://developer.atlassian.com/jiradev/jira-platform/building-jira-add-ons/jira-plugins2-overview/jira-plugin-module-types/search-request-view-plugin-module I found that I can successfully import the following packages:
import com.atlassian.jira.issue.search.SearchException;
import com.atlassian.jira.issue.search.SearchRequest;
but cannot import these packages:
import com.atlassian.jira.issue.search.SearchProvider;
import com.atlassian.jira.issue.search.SearchProviderFactory;
Both SearchProvider and SearchProviderFactory are present in the javadocs for the latest version of JIRA, yet I can't import them despite them being in a package from which I've already imported.
Why is this? I suppose it's some sort of dependency issue but I can't seem to find a way to fix it. I'm developing in Eclipse, by the way.
Any help is appreciated. Thanks!
The problem was that in the generated pom.xml for JIRA plugin projects, the jira-core dependency is commented out. To access all developer classes, the following must be enabled.
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>

java: package does not exist error only after build

I'm trying to add the JCodec library to my android studio project. I followed the steps listed here. I import these four lines:
import org.jcodec.codecs.h264.H264Decoder;
import org.jcodec.common.AndroidUtil;
import org.jcodec.common.model.ColorSpace;
import org.jcodec.common.model.Picture;
I get no errors until I build my project. When I build the project, I get an error that each of the packages I tried to import don't exist. Does anyone know what the problem is?
Thanks!
I did not really understand how linked answer helped you to add library because it is for Eclipse and you are using Android Studio and Gradle.
In build.gradle you should add:
dependencies {
...
compile 'org.jcodec:jcodec:0.1.9'
...
}
I figured out my problem. The issue was that I added the library under libraries but it wasn't a jar file, it was an android project. What I did to solve the problem was adding it as a module and then adding the module as a dependency to my project.

Categories

Resources