Since I'm relatively new to maven, I followed a quick tutorial to set up maven and install it to create a custom plugin in IntelliJ. I followed the tutorial outlined here. After running BuildTools.jar and running $ mvn install, I tried creating a new project.
However, every time I reference a class in net.minecraft.server.v1_8_R3, it brings up two options: one with the reference net.minecraft.server.v1_8_R3 and another duplicate in net.minecraft.server.v1_8_R3.v1_8_R3. I doubt this is supposed to happen since when I add it as a regular dependency in IntelliJ, the duplicates disappear and all the net minecraft classes share net.minecraft.server.v1_8_R3.
Another weird thing I've found is how certain classes, for instance CraftPlayer, will only show up once with the path net.minecraft.server.v1_8_R3.v1_8_R3 which might possibly indicate that this isn't a duplicate folder...?
How would I fix this? I've tried google searching but nothing relevant seems to come up. Would running $mvn install again do anything?
run mvn:dependency tree and resolve the jar conflicts
Related
I initially created a plain Java project that followed the steps mentioned here and here but unfortunately, my project didn't work, I am getting this above error. I have not reached the step where it talks about integrating selenium.
Just to mention I used all the latest versions of the jar files as shown below.
I also got other various problems also, and to resolve them when I searched on the internet everyone was talking about the configuration inside the pom.xml file. But this file comes in the Maven project! so I converted my project to a Maven project. But that too didn't resolve my issues so I "disabled the Maven nature". No luck even after that.
currently, it is a Maven project but when I am following this step it is giving me the subject error.
This is how my package explorer look like:-
The trick is to start small with something working. And then after each change check if it still works. This will help you build an understanding of what each component and change does without overwhelming you.
Unfortunately you are following tutorials that do a whole lot at once. Try to break this down a bit. First learn about Maven, with plain Java and maybe a unit test. Then learn about how Eclipse works with Maven projects. Then use Cucumber with Maven, then add Selenium.
This may seem like a lot more work but it is faster because you'll only have to solve one problem at a time.
I don't have any tutorials for Maven or Eclipse but for Cucumber you use:
https://docs.cucumber.io/docs/guides/10-minute-tutorial/
I am trying out the workflow where you create and maintain your project primarily in Maven, and the Intellij IDEA project files are derived from that, which seems to be the recommended way these days.
My setup: Windows 7, JDK 11, Maven 3.6.0, IDEA Community 2018.2.6, the latter three all fairly fresh installs, not messed around with, verified as working in their own right.
https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html followed steps to create a Hello World project, verified it compiles and runs with Maven after adding the project property entries to specify we are not on Java 5 anymore.
Opened the project in IDEA by opening pom.xml and saying yes, this is a project file.
Opened App.java, and references to String are underlined in red: Cannot resolve symbol 'String'.
Tried invalidate caches / restart, no change.
Consensus as far as I can tell is that maven is the top build system and IDEA is the top IDE, so it must be possible to get them to work together. How?
Open Project Structure (by pressing F4):
Check the SDKs and Problems sections for any error.
I have successfully followed the instructions from amura.cxg's Stackoverflow question/answer on how to setup Eclipse for ANTLR4 (Thanks amura.cxg!).
It works well, my .g4 grammar files are getting run through ANTLR4 fine. One downside is the ANTLR4 plug in has no option for setting the -package argument to the command line, but -listener/-visitor options are present.
My issue is... now I have these cool *.java artifacts as a result of using the plug-in. I want Eclipse to either build them in place, and allow my *.java code at the bottom of the screen to find the *.class files, or have Eclipse auto move/copy them to be sources in the *.java projects below (I don't care as long as it's automated and works).
I'm looking for a way to do this. I would hope I don't have to setup and install MAVEN.
Currently my *.java code which is dependent on the BaseListener.java classes won't build because the classes are not getting built.
Thanks!
I started with Linked resources and had some success, but it still wasn't perfect.
I found this information from
this StackOverFlow Questionwith an answer from srinivasan.
This is the screenshot to create linked resources. This was the method I wanted to understand.
There are two ways to create linked resources. One "add a Folder", this method I tried first, and was not exactly what I wanted, as it created an extra layer and forced the naming of the lcoal folder. By using the Properties tab, I was able to create a local alias for the resource. I think this will ultimately be the solution.
I'm still testing it, but I wanted to post my findings so far in case I get too busy to document my progress in learning later.
:)
I'm asking and answering this question to save me from going down this rat hole again in the future.
I'm building a cross platform eclipse IDE based software development environment with about 40 plugins. When I installed the latest nightly build and did some testing on my Linux test system the application started throwing the dreaded java.lang.NoClassDefFoundError when I did a certain action. This was not happening on my Windows installation. It did not happen in my development environments on Linux or Windows. This action and the code behind it is new and so not yet covered in our automated test suite.
The plugin throwing the exception was trying to access a static class method in another plugin, but failing to find the class. Things I tried:
First thought: static initializer fails for some reason! Nope. I can see other plugins access this static class and methods prior to the failure (by attaching my debugger to the installed instance of my product and stepping through the code).
The fact that it works from other plugins eliminate the other usual reason for failure, not properly exporting the package. It was exported correctly.
I poured over my plugin dependency list, comparing them to plugins that were able to access the offending class, but with no success. All dependencies were accounted for.
I did a deep dive into my MANFEST.MF. I switched from using "Required-Bundle" to "Import-Package" in the MANIFEST.MF. That created new problems for me so I reverted that change. Everything looked good.
My build.properties looked good. Not too much in there to go wrong. It was consistent with my MANFIEST.MF where it counts.
I deconstructed my plugin on the installed instance to be sure that the class was indeed present. It was.
Everything was configured correctly. Everything!
I poured over many related SO questions and blog posts but none of them offered a solution that worked or any additional insight into the problem.
The next step was to start iterating over my nightly builds to find the build where the problem first showed up. Once I identify that build, I'd be able to iterate over all the commits from the day before, doing full builds, then installs to find the commit that broke it.
I started 10 days prior and installed every nightly build. All the way up to the build that failed in my test environment. Every single one of them worked. Why?. See my answer below (or submit you own).
When testing a new eclipse IDE build make sure you start with a fresh new non-existent workspace directory and use the "-clean" command line parameter to flush any caches that survive from a previous installation.
The failure was happening because I (1) failed to delete my previous workspace directory before starting the application; and (2) did not use the "-clean" command line parameter to delete related cached information; and (3), even "-clean" may not be enough, I also removed the entire application directory (which, in turn, removed the 'configuration' directory and all cached data within that may not have been "cleaned" by the "-clean" command line argument).
I had been refactoring a few class names to have more meaningful names. When I ran the product with an existing environment the product was using cached data, getting the old name of a class that had been renamed, and failing to resolve it. (You might think that seeing the old name was a good clue, but, unfortunately, one of the first things I tried was undoing the class name refactoring, thus restoring the previous name. So the error reported the correct name, but, I suspect, there is a signature of sorts that did not resolve.)
Of course it is a best practice to always start with a new workspace when testing. I've been doing Eclipse IDE development for years and I know this well. But yesterday I forgot (not helped by the fact that my Windows installation did not suffer the same error for whatever reason). You will forget on occasion...and it will bite you.
So I have a project that works totally fine in one workspace on my machine. I push it to the repository so everyone else can work on it. I go to pull it down making sure all the changes are good. I import the project into a new workspace and using eclipse with autobuild on it produces no errors.
I go to the command line and run ant clean release on the project and right before it gets to run crunch on the assets the build fails with a mulitple dex files define error. Ive checked the project high and low and compared to the other copy of it in the original workspace but for what ever reason I cant get it to build. I erase the bin and gen folders and remove all the imports and basically leave just the project, run clean in eclipse, and still get a dex define error related to one of the lib projects classes. Ive tried to find where extra copies could be but I dont find anything.
googling around for the past few days hasnt helped as the normal solutions to such a problem havent worked for me. So what is the best way to figure out where the extra class definitions are coming from so I can get rid of them and fix the repository so I can use it correctly. I have a feeling its related to one of the files in the project that I should be excluding in my gitignore but Im not sure which that would be. Any help on the matter would be greatly appreciated cause this has eaten quite a bit of time of just messing around.
When you have more than one class with the same package name this error would raise.
One of the common source of this issue is when you have for example different version on the same library.
For example your add ActionbarSherlock which in 'libs forder has it's own support library and also your project has another version of support library in it's libs folder. In such a cases you should put one version of support library.jar to all different libraries that you using it.
I hope this could help you.
I didnt find the root of the problem but I figured out a fix. I moved all the support libraries to a new root folder completely away from the android project. Once I did that and cleaned everything I then ran ant clean release and the project built fine.