I'm working on a Slick 2D project, with JDK 15, using Eclipse 09-2020, and I am resolving my dependencies via Maven. When I add Slick2D to pom.xml, it shows an error in the IDE at xsi:schemaLocation, saying "Missing artifact javax.jnlp:jnlp-api:jar:5.0"
I've tried re-downloading Java, resetting my JAVA_HOME variable, but to no avail. The other problems that I've come across reference "javaw.jar" in the lib directory, but that is not present in my JDK. How do I solve this?
Here's my pom.xml, if it helps:
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.newproject</groupId>
<artifactId>newapi</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Slick Based API</name>
<dependencies>
<dependency>
<groupId>org.slick2d</groupId>
<artifactId>slick2d-core</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>
Just a general note: The slick project seems dead. The official source repo has been taken offline. I would probably not use it for a completely new project.
But now to your question:
Java Webstart has been removed starting from Java11 since oracle did not opensource it. So what can you do?
You downgrade to Java 9/10
You use https://openwebstart.com (some adaptions might be necessary)
You remove JNLP from the project (since there are other means to start it)
Some other guy seems to have taken up the project. You can find it on github. In one of the forks JNLP has been removed, too.
Related
I am trying to get a specific kind of file structure in eclipse for my work.
This is the structure I want:
The problem I am having is that everytime I use mvn eclipse:eclipse the structure of the files gets broken like this:
I have tried most of the answers that I've found on Stack Overflow and elsewhere. I've tried making the fileStructure2 to a maven Archetype and it sort of worked, but as soon as I ran mvn eclipse:eclipse it broke again:
I learned the basics of the archetype creation just today so I am not a master at that either and there might be something that is missing from the creation of the archetypes. I used mvn archetype:create-from-project in the FileStructure2 directory and then used mvn install archetype:update-local-catalog in the archetype directory which resulted the archetype to be added in the list of archetypes and I just created a new project with cmd and then ran mvn eclipse:eclipse which resulted in the above picture. I have not changed anything in the archetype folders that were created, I just used the basic ones that were created with running the archetype:create.
Most of the other posts i've found are really old and none of them have the structure I want, or it is only for src/main/java which I get working as intended but it is just the src/main/groovy file that switches the location to a normal folder instead of a source folder.
I am thinking it is my pom.xml that needs some modifications. at the moment it looks like this:
<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>FileStructure</groupId>
<artifactId>FileStructure</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.5.0</version>
<type>pom</type> <!-- required JUST since Groovy 2.5.0 -->
</dependency>
</dependencies>
</project>
I have not added any maven compiler plugins since I don't 100% know what they do and still break the structure no matter what I've tried.
I am using apache-maven-3.8.5 which is downloaded with chocolatey. My eclipse jre and jdk versions are 1.8.0_333 but my java home is jdk11 since sonarQube can't use that old versions. My groovy is downloaded from the eclipse marketplace and it's compiler version is 2.5. My eclipse is a SAP netweaver. Eclipse Java EE IDE for Web Developers. Version: Oxygen.3a Release (4.7.3a)
I have converted the projects to maven and groovy via Eclipse's own methods.
Eclipse Groovy Development Tools will do this. There is a guide here with steps to achieve your desired result:
https://github.com/groovy/groovy-eclipse/wiki/Groovy-Eclipse-Maven-plugin
There is an archetype as well but it is not pre-built: https://github.com/groovy/groovy-eclipse/tree/master/extras/groovy-eclipse-quickstart
I'm trying to figure out the best practice for updating the version in a POM file that is used by several other Java projects. I'm new to Java and Maven, but not OOP and semver.
I took over a few git repos with Java code using a maven build system. I need to add new features to a "core" repo that is used by several other repos, even though I only need one of the repos to benefit from the new features. My hope is to leave the other repos untouched. If the other repos get redeployed by some devops process, I want them to use the version of "core" without any changes I added to "core".
I think I should update the version in the POM file of the "core" repo before storing its artifact in Nexus so the other repos won't download the version of "core" containing my changes. What mvn command should I use?
Right now, the "core" library declares its version like:
<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.company.team</groupId>
<artifactId>foo-core</artifactId>
<version>1.0.4-SNAPSHOT</version>
<packaging>jar</packaging>
<name>foo-core</name>
<url>http://maven.apache.org</url>
<blah/>
<blah/>
</project>
The projects that use "core" have a POM that looks like:
<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.company.team</groupId>
<artifactId>bar</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<description>Bar</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>com.company.team</groupId>
<artifactId>foo-core</artifactId>
<version>1.0.4-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
I'm not sure when <parent> is a useful tag, but I notice it is not being used to connect the application repos to the "core" repo.
I imagine I want to update the POM
for the core
and for the one project that uses the core, but not the other projects that also use the core.
I interpret the fact that the version -SNAPSHOT is used in references to "core" by all the other projects to tell me that no "release" was created for the "core", at least at the current version. Can I skip ever making a release for 1.0.4 if I want to the version of "core" container my features to be 1.0.5-SNAPSHOT?
What are the commands I need to execute in both the "core" repo and the repo for the one project I want to use the new build? I think some commands simply modify the POM, but other commands will publish the build to Nexus.
Or can I just type a new number in the POM and run a mvn command to push the build to Nexus with the new version? If I simply change the value with a text editor, I plan to leave the word -SNAPSHOT in the incremented version of "core" as well as the reference to "core" in the one app I want to use the new features. Then I will just need to publish core to Nexus.
--- UPDATE ---
I learned that this command will bump the version number in "core". It seems unnecessarily complex since you still need to type in the full version value when prompted by the CLI (I typed "1.0.5-SNAPSHOT").
mvn versions:set nestSnapshot
And I guess this is how you update the app to use the latest version of the dependency, but I think it only works if you succeeded to publish the dependency with mvn deploy.
mvn versions:use-latest-releases -Dincludes=com.company.team:foo-core -DallowSnapshots=true
You can just go to the two POM files you mentioned and change the version number in the file.
I would first change the version of the core, then run a build mvn clean install (if this done on your local machine) or mvn clean deploy (if you want to sent it to your company repository) and then change the version number of core in the other project.
Note that SNAPSHOT versions are for development. When you want to release something, create a release version, e.g. through the Maven release plugin.
I was looking for a Random name generator and found https://github.com/DiUS/java-faker on GitHub. There it says:
In pom.xml, add the following XML stanza between <dependencies> ... </dependencies>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>0.16</version>
</dependency>"
I am not familiar with Maven or Gradle or how it works, nor did the documentation of Maven really help me with importing this library into my Java project in Eclipse.
Would be thankful for any guidance (links) towards the documentation/info I need in order to understand how to use this library via either Maven or Gradle. Is this actually that complicated? Why can I not just download and add the library to my build path?
Gradle
Make sure you have Gradle installed by running gradle -version.
Create a directory for your project and navigate into it. Open a terminal.
Execute gradle wrapper. You'll see gradlew and gradlew.bat files and gradle and .gradle directories created. From now on, you can forget about global Gradle installation as you can use wrapper. Wrapper can be used even when Gradle is not installed.
Create a file named build.gradle. It's a project descriptor in Gradle:
plugins {
id 'java'
}
repositories {
jcenter()
}
dependencies {
implementation("com.github.javafaker:javafaker:0.16")
}
Import the project in Eclipse.
Maven
Make sure you have Maven installed by running mvn -version.
Create a directory for your project and navigate into it.
Create a file named pom.xml or build.gradle. It's a project descriptor in Maven:
<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.your.company</groupId>
<artifactId>app</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>0.16</version>
</dependency>
</dependencies>
</project>
Import the project in Eclipse.
Is this actually that complicated?
As you see, no, it's not complex at all!
Why can I not just download and add the library to my build path?
You can. This approach just don't scale when you have dozens and hundreds of dependencies (with their own dependencies). Plus, modern software needs not only to be compiled, but tested, packaged, released & distributed. Though you can do most of that from your IDE, but… This appriach just don't scale. Just because people use different IDEs. Because there is no IDE on a build server. Because when you know Gradle or Maven a little bit better, you'll see that it's even faster to accomplish tasks via build tool then via menu items.
Happy hacking!
I am a programmer new to Java world.
I am using Intellij-idea, Maven, & Selenium.
I followed instructions exactly to generate Selenium Project.
The link is:
http://www.seleniumhq.org/docs/03_webdriver.jsp
The directions ask you to
create project folder
drop pom.xml they gave you into Project folder
edit group & artifact tags of the Pom.xml
Run “mvn clean install” command
So I am enclosing the pom.xml I used, and I followed directions above using “FWSDriverProject” as my folder (for pom.xml file, see bottom of this message).
Since I don’t have an old version of Intellij, and the directions on the Selenium site are old, I couldn’t follow them exactly, but I did notice that a jar file was created for me in target subfolder of the project, and I am familiar on how to use jar files so I thought it worth a shot.
I created folder called C:\Java\FWS_SeleniumJarConsumer & then created simple command-line app within that folder.
I added libs folder, C:\Java\FWS_SeleniumJarConsumer\libs.
Then I dropped the JAR file created for me, into this folder.
Then, within Intellij, I opened my FWS_SeleniumJarConsumer project, and I right-clicked on the jar file and selected “Add to Library”.
I was greeted with “IDEA cannot determine what kind of files the chosen items contain. Choose the appropriate categories from the list.”
It allows you to select multiple. Since I wasn't sure what to select, I chose all of them.
I didn't get any errors.
But when trying to use the imports provided in the sample code, I get error.
import org.openqa.selenium.By;
The error say:
“Cannot resolve symbol openqa”
Any ideas on how to get basic Selenium project up and running using IntelliJ & Java?
I am using latest Maven and IntelliJ-idea. Tutorial on link is old.
<?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>HCFCD</groupId>
<artifactId>FWSDriver</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.21</version>
</dependency>
</dependencies>
</project>
I did a similar project and I followed this tutorial to be able to create maven build and execute Selenium test in Java with IntelliJ. This should solve your problem.
Look at this video: https://www.youtube.com/watch?v=rQG_GBTFWQ4
Git repository: https://github.com/Krotov/FirstWebDriverTest
Mathieu
I have a new app, the pom for which has parent tags and all. I have to include in this app another dependency whose parent is different than the current apps parent. The problem is the version tag for the new dependency.
The current pom :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
<parent>
<artifactId>abc-pom</artifactId>
<groupId>com.abc</groupId>
<version>4.480.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>com.abc.libs</groupId>
<artifactId>dynamixSession</artifactId>
<packaging>jar</packaging>
<name>dynamixSession</name>
.....
.....
<dependency>
<groupId>com.pqr.someOtherProject</groupId>
<artifactId>SomeCoreProcessing</artifactId>
<version>4.2.14.2-SNAPSHOT</version>
<!-- <version>${project.version}</version>-->
<scope>provided</scope>
</dependency>
This pom works. Since I am hardcoding version number here, do I need to update this pom everytime the version changes ? Or will it be updated automatically. But I doubt that it updates automatically.
I would like to use '${project.version}' so that I don't have to update it. But if I use '${project.version}' it tries to look for 'com.pqr.someOtherProject.SomeCoreProcessing:4.480.0-SNAPSHOT', which is not existing.
Is there a way arround this or am I stuck with harcoding the version in my pom ?
Thanks
You can use versions plugin to achieve that. It would be the easiest way. The plugins is especially used for these kind of requirements.
But it would not be automatically updated. You would need to execute versions:use-latest-snapshots goal.
If you are using a continuous integration tool (e.g. Jenkins) you can automate this with nightly builds or some other way.
Just have a look at below link to see all the details of versions plugin. It is nicely documented.
http://mojo.codehaus.org/versions-maven-plugin/
Why don't you try {env.SomeCoreProcessing_version} instead? Just make sure you set/export the SomeCoreProcessing_version variable before kick starting your build.