This is my pom file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>mavenproject2</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-distribution</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>org.semanticweb.hermit</artifactId>
<version>1.3.8.500</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
I just want to make simple examples like this:
OWLOntology o = manager.loadOntologyFromOntologyDocument(file);
System.out.println("--------------------------");
OWLReasonerFactory rf = new ReasonerFactory();
OWLReasoner r = rf.createReasoner(o);
r.precomputeInferences(InferenceType.CLASS_HIERARCHY);
But ReasonerFactory is not recognized by the system.
I downloaded the jar file, installed maven, opened a netbeans project using a maven project. Why it doesn't works??
Use OWLAPI version 5.1.7 and HermiT version 1.4.3.517.
The problem here is that in the version you used ReasonerFactory is an inner class in the Reasoner class, but your test code relies on it being a standalone class. That happened in a later version of HermiT.
1.4.3.517 is the most recent release and includes a few bug fixes, hence I recommend using it in place of all the other OWLAPI 5 compatible versions.
Related
I am new to spark and is trying to build a simple project in java with IDEA. This test project simply read txt file as javaRDD and display its content.
When I am trying to build my project, I got error
java: cannot access scala.Cloneable
class file for scala.Cloneable not found
at line
SparkConf conf = new SparkConf().setAppName("test_app").setMaster("local[*]");
and
java: cannot access scala.Serializable
class file for scala.Serializable not found
at
for(String line:lines.collect()){
System.out.println(line);
}
From my understanding this means IDEA do not have scala dependency. However, in my pom file, spark dependency shows
Dependency 'org.apache.spark:spark-core_2.13:3.3.1' not found
My pom.xml looks like this.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>spark_test_project</artifactId>
<version>1.0</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spark.version>3.3.1</spark.version>
<java.version>11.0.16</java.version>
<scala.version>2.11.12</scala.version>
<java.compat.version>11.0.16</java.compat.version>
</properties>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.13</artifactId>
<version>3.3.1</version>
</dependency>
</dependencies>
</project>
How should I solve this issue?
I tried to install jar dependency manually in IDEA but this would not solve the issue. My current scala version is 2.11.12.
I've started to create a java project using the dropwizard framework and maven. My pom.xml file looks like
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.dexcane</groupId>
<artifactId>dexcane-backend</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<dropwizard.version>2.1.4-SNAPSHOT</dropwizard.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/io.dropwizard.archetypes/dropwizard-archetypes -->
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>2.1.4-SNAPSHOT</version>
<type>pom</type>
</dependency>
</dependencies>
</project>
I'm following the dropwizard tutorial. When I hover over the "2.1.4-SNAPSHOT" dependency Intellij says "Dependency 'io.dropwizard:dropwizard-core:2.1.4-SNAPSHOT' not found ". Does anyone know what's wrong with the import? The tutorial says the current version of dropwizard is 2.1.4-SNAPSHOT.
You shouldn't add it with the type of pom as its packaging is jar.
The title says it all really, my pom is shown below:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>CouncillorsApp</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.12.6</version>
</dependency>
</dependencies>
</project>
The following error is given:
"Dependency 'org.mongodb:mongodb-driver-sync:3.10.2' not found"
I'm using Java 14.0.2 and the latest version of IntelliJ
please read installation
you can try this
<dependencies>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.12.6</version>
</dependency>
</dependencies>
So after restarting IntelliJ the above code seems to work fine. I'm unsure of where the issue was, but the dependency is being found now without any changes to the pom.
I would like to invoke that method:
https://github.com/spring-projects/spring-boot/blob/2.0.x/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java#L73
But it's not available. It's not even present in decompiled code. But it should be, since JavaDoc says it's available from 1.3.0 version and it's public. My version is 2.0.0, I also checked 1.5.4. The link I gave is for 2.0.x and in GitHub it's still there. But in code it's not available, why?
POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
</dependencies>
</project>
Code:
import org.springframework.boot.autoconfigure.web.ErrorProperties;
public class Test {
ErrorProperties errorProperties = new ErrorProperties();
public Test() {
//Cannot resolve method getWhitelabel()
errorProperties.getWhitelabel();
}
}
That method is not in 2.0.0, nor in 2.0.3, but it is in 2.0.4 (the current latest version).
Change your pom.xml to:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>2.0.4.RELEASE</version>
</dependency>
</dependencies>
And it will compile.
I have a dependency called "general-lib" which will be modified and used by 3 teams.
Admin, Child-ABC and Child-XYZ are those 3 projects. Those 3 apps
deployed in same server.
Child-XYZ and Child-ABC are communicating to
Admin app frequently.
When we change general-lib version, I want
that Child apps also should use same version what admin app uses.
Finally that particular dependency version should be managed at super application.
is there any to do that ? Please let me know if I need to explain better.
You can define a BOM (Bills of Materials) where you can move the dependecyManagement for the common artifacts and then declare it as a parent in your 3 projects. This is an example of BOM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>your.group.id</groupId>
<artifactId>whatever-BOM</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<general-lib.version>1.0.2</general-lib.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>your.groupid</groupId>
<artifactId>general-lib</artifactId>
<version>${general-lib.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
For more details on BOM, you can read the article Spring with Maven BOM that even if it's related to Spring, it will explain in a detailed way what are BOMs and how to use them.
Ohter possibility, is to define those 3 projects as a module of a higher level project and manage in this one the dependencyManagement.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>your.group.id</groupId>
<artifactId>whatever</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
<module>Admin</module>
<module>Child-ABC</module>
<module>Child-XYZ</module>
</modules>
<packaging>pom</packaging>
<properties>
<general-lib.version>1.0.2</general-lib.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>your.groupid</groupId>
<artifactId>general-lib</artifactId>
<version>${general-lib.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>