title: "Unresolved dependency" / "import cannot be resolved" in VS Code Java language support when working with Artifactory dependecies
body: <p>We have a bunch of private Java dependencies published to Artifactory. We are using Gradle to build our project.</p>
  <p>The issue is that VSCode Language Support for Java does not recognize the dependencies / imports in <code>build.gradle</code> or in our Java source code.</p>
  <p><em>Note: All the snippets below were copy-pasted exactly from the source code / VS Code messages, with the exception of the company domain being replaced with mycompany.com and the Artifactory credentials redacted.</em></p>
  <p>The errors I'm seeing in the Java source code are:</p>
  <pre><code>The import com.mycompany.observability cannot be resolved
  </code></pre>
  <pre><code>MycompanyLogger cannot be resolved
  </code></pre>
  <p>Here is the Java file with the errors:</p>
  <pre><code>package com.mycompany.sample;
  
  import com.mycompany.observability.logging.MycompanyLogger;
  
  public class SampleApplication {
  
    public static void main(String[] args) {
      MycompanyLogger.setServiceName(&quot;SERVICE_NAME&quot;);
    }
  }
  </code></pre>
  <p>And the errors in <code>build.gradle</code>:</p>
  <pre><code>Unresolved dependency: com.mycompany:core-observability-spring:0.0.37
  </code></pre>
  <p>Here is the <code>build.gradle</code> file:</p>
  <pre><code>plugins {
      id 'io.spring.dependency-management' version '1.0.9.RELEASE'
      id 'org.springframework.boot' version '2.3.4.RELEASE'
      id 'java-library'
      id 'application'
      id 'checkstyle'
      id 'pmd'
      id 'jacoco'
      id 'com.jfrog.artifactory' version &quot;4.17.2&quot;
      id &quot;org.sonarqube&quot; version &quot;3.0&quot;
  }
  
  group = 'com.mycompany'
  version = '0.0.1-SNAPSHOT'
  
  java {
      sourceCompatibility = JavaVersion.VERSION_11
      targetCompatibility = JavaVersion.VERSION_11
  }
  
  repositories {
      mavenLocal()
      mavenCentral()
  }
  
  jar.archiveBaseName = &quot;sample-service&quot;
  mainClassName = 'com.mycompany.sample.SampleApplication'
  
  apply plugin: 'com.jfrog.artifactory'
  apply plugin: &quot;java&quot;
  
  artifactory {
      contextUrl = &quot;https://artifactory.mycompany.com/artifactory/&quot;
      resolve {
          repository {
              repoKey = 'gradle-release'
              username = project.findProperty('artifactory_user')
              password = project.findProperty('artifactory_key')
              maven = true
          }
      }
  }
  
  dependencies {
      implementation('org.springframework.boot:spring-boot-starter-web')
      implementation('org.springframework.boot:spring-boot-starter-aop')
      implementation('org.codehaus.janino:commons-compiler:3.1.0') // Conditional expressions in logback
      implementation('org.codehaus.janino:janino:3.1.0') // Conditional expressions in logback
      implementation(&quot;ch.qos.logback:logback-classic:1.2.3&quot;)
      implementation('net.logstash.logback:logstash-logback-encoder:6.3')
      implementation('com.datadoghq:dd-java-agent:0.51.0')
  
      implementation('com.mycompany:core-observability-spring:0.0.37')
  }
  
  checkstyle {
      toolVersion &quot;8.29&quot;
      configFile = file(&quot;${rootDir}/config/checkstyle/google_checks.xml&quot;)
  }
  
  jar {
      enabled = true
  }
  
  pmd {
      ignoreFailures = false
      ruleSetFiles = files(&quot;config/pmd/mycompany_custom_ruleset.xml&quot;)
      ruleSets = []
      sourceSets = []
  }
  </code></pre>
  <p>and here are the relevant files in my <code>~/.gradle/</code> directory:</p>
  <pre><code>➜  .gradle cat gradle.properties
  artifactory_user=&lt;redacted&gt;
  artifactory_key=&lt;redacted&gt;
  </code></pre>
  <pre><code>➜  .gradle cat init.gradle.kts  
  settingsEvaluated {
      pluginManagement {
          val artifactory_user: String? by settings
          val artifactory_password: String? by settings
          val artifactory_key: String? by settings
  
          repositories {
              maven(url = &quot;https://artifactory.mycompany.com/artifactory/gradle-release&quot;) {
                  credentials {
                      username = artifactory_user
                      password = artifactory_password ?: artifactory_key
                  }
              }
              gradlePluginPortal()
          }
      }
  }
  </code></pre>
  <p>Lastly, here are my <code>.vscode</code> config files for this project:</p>
  <pre><code>➜  .vscode git:(vscode-settings) cat settings.json 
  {
      &quot;[java]&quot;: {
          &quot;editor.formatOnSave&quot;: false,
      },
      &quot;editor.formatOnSave&quot;: true,
      &quot;files.insertFinalNewline&quot;: true,
      &quot;files.trimFinalNewlines&quot;: true,
      &quot;files.trimTrailingWhitespace&quot;: true,
      &quot;terminal.integrated.scrollback&quot;: 10000,
      &quot;java.configuration.updateBuildConfiguration&quot;: &quot;automatic&quot;,
      &quot;java.import.gradle.enabled&quot;: true,
      &quot;java.import.gradle.wrapper.enabled&quot;: true,
      &quot;java.import.maven.enabled&quot;: false,
  }
  </code></pre>
  <pre><code>➜  .vscode git:(vscode-settings) cat extensions.json 
  {
      &quot;recommendations&quot;: [
          &quot;gabrielbb.vscode-lombok&quot;,
          &quot;pivotal.vscode-spring-boot&quot;,
          &quot;richardwillis.vscode-gradle-extension-pack&quot;,
          &quot;vscjava.vscode-java-pack&quot;
      ]
  }
  </code></pre>
  <p>Everything works fine when compiling the app using <code>./gradlew build</code>:</p>
  <pre><code>➜  sample-service git:(master) ✗ ./gradlew build
  
  BUILD SUCCESSFUL in 5s
  11 actionable tasks: 8 executed, 3 up-to-date
  </code></pre>
  <p>Any ideas on what should be my next steps in debugging this?</p>