How to add external dependencies in VS Code? - java

I have a Java project, which is an Intellij IDEA project, not a maven or Gradle project,
I want to work with the project in Visual Studio Code now, but I have a problem, I have an external dependency for handling CSV files called Jsefa(Java Simple Exchange Format API).
How can I add this dependency to my Visual Studio Code Project so that I can build the project in VS Code easily that uses this library??
Can I do this with some modifications in the settings.json file? or is there another way??

Related

How to reference classes from a Maven project in Eclipse 2019-09?

Using Eclipse 2019-09, my goal is to use OpenPDF library, but first, I need to be able to debug its code a bit when calling from my test project.
I have created a workspace where I have created a simple java program that would open a PDF.
I have cloned the OpenPDF repo, and I have added the projects to Eclipse. They are Maven projects.
Now, I need to setup the relation between the projects, in order to use OpenPDF code.
I've read here that I should add openpdf project to the Projects in Java Build Path of my test project, but that is not clear. If I add the openpdf project to the Classpath entry there, it's not compiling because it does not find the openpdf project classes.
So, what is the right setup? (I am not asking how to refer a library through Maven and I don't intend to build a signed Maven library).

Combining a maven project with a java project

Currently, I have a maven project that has a server running (using Jersey REST API). I also have a java project, I need to move all the contents of the java project into the maven project. The maven project is a subset of the java project. However, the maven project only displays the parts of the java project. However, I want a project that allows me to use maven and displays all of the other details from the java project.
I would've copied and pasted however I'm using git so I want to also preserve history.
I was thinking it would be easier to nest the maven project inside the java project but I don't know if that's possible.
Here's a picture of my package explorer to help explain everything.
Package explorer showing the maven project being a subset of the java project.
What I've tried is converting the java project into a maven project and then updating the pom.xml but then it doesn't link to the web.xml. Also, it tries to run the server with the name of the project name TeamProject. When infact it should run the url with the name client_server
I was considering just copying and pasting all the code into the maven project (from the Teamproject java project).
Actually nesting the java project inside the Maven project makes more sense, as it is the purpose of Maven to handle a project lifecycle. (also by default Maven will look for sources in the src/ folder which should ease the task of putting your Java project inside Maven's hands)
There are several possibilities I would see:
Copy your java project in the src/ of your client project and update maven accordingly (within the pom.xml)
Make your Java project a Maven project and aggregate the two projects in a parent pom (see Multi module maven project example)
Make your Java project a Maven project, and decide of a "Master" project between it and the client and compose one with the other (not sure that's a great solution)
Nesting your Maven project inside the Java project would not be so great because Maven could only handle the client and not your Java project, and then you'd miss on numerous functionalities offered by Maven (just look at how simple it is to get dependencies compared to downloading a jar and including it on the build path manually)

How Do I Import a Non-Android Eclipse Maven Project into Android Studio?

I am starting at a disadvantage as I know neither Eclipse, Gradle or Android Studio. As such, I may not be using the correct terminology for everything, but I'll give it a shot. My ultimate goal is to get a working Eclipse-based Android app imported into Android Studio and hand it back to the Android developer. This question is about a problem I encountered on the way.
I have successfully imported the main Android project into AS. Now I'm trying to pull in another project it depends upon as a module. The dependency is a Maven project. It has a pom.xml, a .project and a .classpath. It's not an Android project, so there's no AndroidManifest.xml. It has a src but no res folder. I want this project to be a module rather than an external dependency as the developer will modify the source code on occasion.
The problem is that AS refuses to accept the project as an importable module. The Add Module dialog, when pointed to the project's root directory, continues to warn that I haven't yet selected a valid Android Eclipse or Gradle project. The Next button stays grayed-out. I agree that this is neither an Android-specific nor a Gradle project, but I have read here that IntelliJ IDEA will import such projects. It appears that AS will not.
There are several other non-Android Eclipse projects that also won't import as modules in the same way. These include ordinary Maven and ant-based libraries.
How do I accomplish this? The GUI seems out to thwart me. If I get down to the Gradle XML level, can I do it and will the modules show up normally in the GUI? Do I have to go back to Eclipse and convert these to Gradle projects first?
Thanks in advance.

How to add Maven to an existing IntelliJ Android project

I've been doing some research on adding Maven to an existing Android project and I'm struggling to see how this works. I've used Maven once at work on a web based project with Netbeans, but for this project I'm looking to use IntelliJ. I can create a new "Maven Module", but I already have an Android project so I'm not entirely sure that's the route I should be taking.
I found this post which does provide some detail, but not a step-by-step windows integration guide (at least that I'm seeing).
Is it possible for me to use Maven within an Android project?
Edit: I'm looking to do this within a Windows environment
To answer your question in the last sentence: Yes, you can use Maven to build an Android project.
You should use the maven-android-plugin in your Maven project. The best place to get started is https://code.google.com/p/maven-android-plugin/wiki/GettingStarted. Need to read up a bit, but definitely worth the effort.
If I have existing IDE specific Android project that you would like to switch to Maven, instead of trying to "add Maven support to an existing IntelliJ project", I would:
Create a new Maven based project using an appropriate archetype https://github.com/akquinet/android-archetypes
Copy existing source/resources to the Maven project directories.
If done correctly, you can open this (Android) Maven project (pom.xml) in IntelliJ and use it like an Android project (including GUI editor). IntelliJ automatically generates an IntelliJ project from Maven's pom.xml and detects the Android facet.
This way, your project also stays IDE agnostic - you can do everything (build/test/deploy) from command line as well - how Maven projects should be IMHO. :D

Introducing scala into existing netbeans java project

I have an existing java project in Netbeans. I would like to start coding parts of it in Scala. I can add ".scala" files to the project but apparently they aren't compiled.
Can I somehow modify the existing Netbeans project settings in order to build java and scala sources together or do I need to create a new project and import the existing (java) sources?
Thanks
Martin
EDIT Sorry, I forgot to mention: I've installed the Scala-Plugin for netbeans, so compiling scala code is feasible.
I can create a new (Scala) project and add both scala and java sources to it and it compiles perfectly. My question was if (and how) it's possible to migrate an existing "java-only" project towards such a "mixed" project.
I don't think this is possible in the way you want it. You could however write an Ant build-script and let Netbeans execute it when building you application.
Otherwise I suggest to just create a new scala project and import it as *.jar library into your Java application. This keeps your project clean and nicely modularized.
You will need to migrate to use something like Maven to do this for you, as Netbeans doesn't know how to compile Scala code. Maven can be configured to compile the .scala files first then the .java, resulting in your final compiled source.
Have a look here for the maven config.
I would recommend doing a new maven project, Project form Archetype, and use the following.
http://mvnrepository.com/artifact/org.scala-tools.archetypes/scala-archetype-simple/1.3
This basically auto imports you a project all set up to get started running scala in a Java project.

Categories

Resources