skip to Main Content

I use Visual Studio Code and ‘Remote – SSH’ extension.
I launch a virtual machine (Ubuntu 22.04) on VirtualBox with bridge network. My host machine is Windows 11 Pro 22H2.
I installed xrdp on the virtual machine, and I can connect to the virtual machine using remote desktop.

When I edit a Java source file using Visual Studio Code on my host via Remote SSH, the source file is not built automatically.

However, I edit the same Java source file using ‘remote’ Visual Stdio Code on the guest virtual machine via remote desktop(xrdp), the source file is built automatically.

To develop using Visual Studio Code on the virtual machine is slow, so I want to develop on my host using Visual Studio Code and Remote SSH extension.

How do I resolve to this problem?

2

Answers


  1. Chosen as BEST ANSWER

    As a workaround, when I add a configuration to maven-compiler-plugin to maven pom.xml and launch maven from command-line, the source file become to be compiled automatically.

    I use Spring Boot, and the configuration example is as follows.

      <!-- ... -->
      <properties>
        <java.version>11</java.version>
      </properties>
      <!-- ... -->
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.11.0</version>
            <configuration>
              <source>${java.version}</source>
              <target>${java.version}</target>
              <compilerArgs>
              <arg>-Xlint:all</arg>
              </compilerArgs>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <!-- ... -->
    

  2. I could solve the problem.
    VSCode extensions on the remote machine were not installed properly.
    ‘Extension Pack for Java’ extension and other extensions did not work.
    In the Explorer pane on vscode, ‘JAVA PROJECTS’ and ‘MAVEN’ sections did not exist.

    When I disabled ipv6 on the remote machine (VirtualBox vm), extensions were installed properly.
    And when I changed a Java source file, autobuild worked without maven-compiler-plugin.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search