Setting up JMonkeyEngine in Intellij IDEA - java

How do you set up JMonkeyEngine in Intellij IDEA. It was not specified in the documentation (http://hub.jmonkeyengine.org/wiki/doku.php/).

now it's easy if you use maven or gradle.
Maven simple pom.xml:
<?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>jme3-example</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JME3 maven project</name>
<properties>
<jme3.version>3.0.10</jme3.version>
</properties>
<dependencies>
<dependency>
<groupId>com.jme3</groupId>
<artifactId>jme3-core</artifactId>
<version>${jme3.version}</version>
</dependency>
<dependency>
<groupId>com.jme3</groupId>
<artifactId>jme3-desktop</artifactId>
<version>${jme3.version}</version>
</dependency>
<dependency>
<groupId>com.jme3</groupId>
<artifactId>jme3-lwjgl</artifactId>
<version>${jme3.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jme3-repo</id>
<name>JME3 maven repo</name>
<url>http://updates.jmonkeyengine.org/maven/</url>
</repository>
</repositories>
</project>
Note 0: JME 3.1 is deployed at JCenter
Note 1: The JMonkeyEngine official wiki is moved to https://jmonkeyengine.github.io/wiki/
Gradle config and other maven dependencies documented here: https://jmonkeyengine.github.io/wiki/jme3/maven.html
If you didn't use maven or gradle before, please, learn it :)

I recommend that you learn using the jMonkeyEngine3 with the jMonkeyEngine SDK,
as that is well documented.
If you want to then use jMonkeyEngine with IntelliJ IDEA,
you can get all relevant information from this tutorial for eclipse:
http://hub.jmonkeyengine.org/wiki/doku.php/jme3:setting_up_jme3_in_eclipse
Of course, you must consider different terminology and UI for setting up things in IDEA.
Basically all you have to do is add the correct .jar files to your classpath.
If you have problems and need more information,
you should probably read more about IntelliJ IDEA Project settings and Java Classpath.
As I said, I recommend "starting" with the jMonkeyEngine SDK.
(Keep in mind that you lose support for jMonkey file types, such as .j3m (jmonkey materials) and .j3o (jmonkey models) when you use IntelliJ IDEA!)

Related

dependencies from pom.xml not being resolved

I'm trying to create a maven project in intellij, to create a parser in antlr. Here is my pom.xml:
<?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.mua</groupId>
<artifactId>json-parser-java-antlr</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Json parser Java ANTLR</name>
<packaging>jar</packaging>
<description>Trying to create a parser using ANTLR in Java, as facing problems with LLVM</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
<dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.commons.io</artifactId>
</dependency>
</dependencies>
</project>
When I click on import changes, it loads for just 1-2 seconds then done. But if I try to import MapUtils from org.apache.commons.collections4.MapUtils it says it can't resolve common, although I added in <groupId>org.apache.commons</groupId> dependency.
I'm new in maven project creation and management.
So, what is the problem here and how can I resolve this problem ?
I studied some pom.xml and found a parent attribute. No idea how to configure that.
My Eclipse editor shows:
Project build error: 'dependencies.dependency.version' for org.antlr:antlr4-runtime:jar is missing.
Project build error: 'dependencies.dependency.version' for org.apache.commons:commons-collections4:jar is missing.
Project build error: 'dependencies.dependency.version' for org.apache.directory.studio:org.apache.commons.io:jar is missing.
None of the dependencies work, because it doesn't know which version of them you want.
Specifying dependencies without a version is something you do when you have a parent pom. You don't, so versions are mandatory.
You could try adding a specific version of antlr to your pom.xml. And if you are using the antlr plugin as well, make sure the version of antlr run-time you are using is the same as the built-in version of the plugin.

How are third party tools such as this accessed within Java?

https://github.com/bvanalderweireldt/concurrent-unique-queue
I have tried to set up a Maven dependency within IntelliJ, but I am not sure how the contents of this repository should be built and imported into a Java project. Could someone with more experience please advise on how this is done?
Kind regards,
L
If you want to use this project in another project, you will create a dependency to this using the dependency entry mentioned on the github readme:
<dependency>
<groupId>com.hybhub</groupId>
<artifactId>concurrent-util</artifactId>
<version>0.1</version>
</dependency>
For this, you need the artifact in your local maven repository*. For this, you need to build this project or use a reference from Maven Central (Thanks #Mark Rotteveel )
Clone the project locally, you need to build it in one of the following ways
Build it from the command line: Navigate to the project's location in your shell (bash or cmd) and run mvn install
This will build the project and add the artifact (jar) to the local .m2 repository.
Import to Intellij Idea (File -> New -> From Existing Sources). Once imported, build this project from the "Maven Projects" view.
Once you have done this, you can use this in other projects using the <dependency> entries
*For production ready apps, you may want to have a common maven repository for team your like Nexus or Artifactory and use that to maintain artifacts. You would also have a build system like Jenkins.
In the link you gave it had the dependency Maven entry for that library.
<dependency>
<groupId>com.hybhub</groupId>
<artifactId>concurrent-util</artifactId>
<version>0.1</version>
</dependency>
That entry would need to be nested into you <dependencies> tag. Like the example below.
<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.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Maven Quick Start Archetype</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>com.hybhub</groupId>
<artifactId>concurrent-util</artifactId>
<version>0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

POM is missing, no dependency information available, cfg.xml not found

I've tried to connect my application with database as described on this site: https://www.visual-paradigm.com/tutorials/hibernateinnetbeans.jsp
I use MySQL and Maven project. But the rest is done the way it was explained on the website and when I run CreateAutoPartsStore I have such output:
The POM for unknown.binary:orm:jar:SNAPSHOT is missing, no dependency information available
[...]
--- exec-maven-plugin:1.2.1:exec (default-cli) # AutoPartsStore ---
org.hibernate.HibernateException: /ormmapping/AutoPartsStore.cfg.xml not found
at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:173)
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:2026)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2007)
at org.orm.PersistentManager.<init>(PersistentManager.java:72)
at autopartstore.AutoPartsStorePersistentManager.<init>(AutoPartsStorePersistentManager.java:31)
at autopartstore.AutoPartsStorePersistentManager.instance(AutoPartsStorePersistentManager.java:41)
at ormsamples.CreateAutoPartsStoreData.main(CreateAutoPartsStoreData.java:65)
This is my pom.xml 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>AutoPartsStore</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<repositories>
<repository>
<id>unknown-jars-temp-repo</id>
<name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
<url>file:${project.basedir}/lib</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>orm</artifactId>
<version>SNAPSHOT</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
I found some solutions to the problem concerning copying XML files to another location, but none of them worked for me.
Looks like you need to add hibernate jar to the Maven dependecies list.
This:
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>orm</artifactId>
<version>SNAPSHOT</version>
</dependency>
informs maven that your repository contains the artifact unknown.binary:orm:jar:SNAPSHOT but it seems it was never installed, and obviously is not present in Maven Central to be downloaded. What is it expected to point to?
Note that .jar lying around in folder marked as Maven repository does not make it count as installed. Also, Maven does not understand the notion of "Jar directory" and will not automatically add to classpath every jar from lib directory, if it is not declared as dependency.

SWT dependency artifact missing?

I want to use swt in my project and used this page as a starting point:
https://code.google.com/p/swt-repo/
I added the repository and dependency but my pom.xml has an error saying:
Missing artifact org.eclipse.swt:org.eclipse.swt.win32.win32.x86:jar:4.4
What could be the problem?
My whole pom.xml:
<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>group</groupId>
<artifactId>artifact</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>artifact</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- SWT -->
<dependency>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.win32.win32.x86</artifactId>
<version>4.4</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>swt-repo</id>
<url>https://swt-repo.googlecode.com/svn/repo/</url>
</repository>
</repositories>
</project>
The problem is that there is no official maven repository that hosts the SWT library files. There were a few sites that worked in the past, but almost all are now abandoned, closed or moved. On https://github.com/maven-eclipse/maven-eclipse.github.io they explain the problem, but the solution described there (to use http://maven-eclipse.github.io/maven) doesn't work because that link will redirect you to the git repository.
The link you posted seems to be the only maven repo that is currently left. I had problems with Maven accessing it properly just like you. I'm not entirely sure what the problem is. I suspect it has something to do with missing or invalid indexes, but I'm not sure. In any case the best solution is to download the required jars and add them to your local repository manually. This is probably a good idea anyway, because Google Code will shutdown in January 2016
BTW, there is an open bug for SWT to be distributed via Maven, but it's been posted in 2007! and there still is no official solution.

connecting eclipse maven to a repository not hosted at maven central

I am trying to set up a maven project in eclipse that downloads resources from a maven repository. How do I set this up?
The description of the repository is at this link. I created a new maven project in eclipse then tried Maven...update project and Maven...download sources, but there is still no content added to the project.
Here is the pom.xml I am using:
<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>some.id.i.made.up</groupId>
<artifactId>EverestTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>EverestTest</name>
<properties>
<!-- Generic properties -->
<java.version>1.6</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<repositories>
<repository>
<id>marc-te-main</id>
<url>http://te.marc-hi.ca/mvn</url>
</repository>
</repositories>
</project>
How do I change my pom.xml or other configurations so that the relevant elements are downloaded?
Note that this library is not hosted in the maven central repository.
Now that you're pointed at the repository, you have to tell Maven which libraries in that repository your project needs. To do this, include the tag:
<dependencies>
<dependency>
<groupId>org.marc.everest</groupId>
<artifactId>everest-core</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.marc.everest</groupId>
<artifactId>everest-connectors-spring</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
The site you linked to has the list of artifacts you may need:
everest-core - Everest core modules
everest-connectors-spring - Everest Spring Connector
everest-formatters-xml-its1 - Everest XML ITS1 Formatter
everest-formatters-xml-dt-r1 - Everest XML Datatypes R1 Formatter
everest-rmim-{ca|uv}-{version} - RMIM Assemblies
You'll need a "dependency" stanza for each one that you want. Similarly, change the version tag to be the version you need.

Categories

Resources