0

Reference to this post:

How to add referenced library JAR files using relative path for eclipse Java project in vscode

I need to convert this project to use a Build technology since the referenced external JAR libraries could not be pushed the the On-premise BitBucket Git repo. I was told that such libraries must be hosted on a central Project Antifactory based on JFrog (https://www.jfrog.com/), then reference them using the relevant build tool. I decided to use Maven since I am familiar with this tool.

I need your help as follows:

  1. How to convert the existing project to use Maven?

  2. How to change the reference to such JAR files from local to use the JFrog Artifactory?

  3. How to ignore the .class, .jar and other files not related to the source code, how I can ask git to ignore such files since they are now showing s Untraced.

Tarek

torek
  • 448,244
  • 59
  • 642
  • 775
tarekahf
  • 738
  • 1
  • 16
  • 42
  • How familiar are you with Maven? (And why couldn't they jar files be pushed on the git repo?) – Thorbjørn Ravn Andersen Sep 30 '21 at 05:38
  • I couldn't push the jar files because of company policy restrictions. I'm familiar with Maven projects. I wanted to find a shortcut to convert rather than rebuilding the project from scratch using Maven. – tarekahf Sep 30 '21 at 06:05
  • You need elbow grease to find maven artifacts corresponding to your current local jars. If you are in a company, find a senior developer to show you how. Also I would wonder why nobody told you how Java is developed in said company. – Thorbjørn Ravn Andersen Oct 05 '21 at 10:27
  • In eclipse there is a convert to Maven option, but not in VS code. I can figure out by doing some extra research or asking someone, and if I don't find the answer, I will find it. – tarekahf Oct 06 '21 at 16:22
  • then use eclipse for this and then go back to vs code. That is the main advantage of maven. – Thorbjørn Ravn Andersen Oct 06 '21 at 16:32
  • Yes, that's my next step if no one provides a direct solution in VS code. Even manual conversion is ok. I'm interested in knowing the basic minimum to make a project maven base without the fancy fluff. – tarekahf Oct 07 '21 at 03:29
  • 1
    Conversion to maven is not hard. Find maven replacements for all your jars and move your sources to src/main/java and resources as well, and write the pom.xml. Get some practice with pom.xml or ask a senior java developer to help you. – Thorbjørn Ravn Andersen Oct 07 '21 at 05:01
  • Yes, that was my plan. I did research and figured out what to do. It's only a matter of implementing it. I also learned that I need to create the file `settings.xml` to direct the Maven engine to use the On-premise jfrog platform for the application artifactoy to download the jar dependencies from, instead of using the public Maven repository. – tarekahf Oct 08 '21 at 19:30

1 Answers1

0

Not familiar about the first two questions but VS Code does have the configuration that can exclude extension-generated project settings files in User Settings.json:

"java.configuration.checkProjectSettingsExclusions": true
Molly Wang-MSFT
  • 7,943
  • 2
  • 9
  • 22
  • Thanks, but this didn't work. What worked is using `"files.exclude":` in both User and/or Workspace settings. I think `"java.configuration.checkProjectSettingsExclusions": true` is only for checking to hide or show such files when you first open vscode. I was never able to find out the effect of this parameter. – tarekahf Oct 01 '21 at 15:57