IntelliJ: use docker jvm or docker maven?

后端 未结 2 1829
猫巷女王i
猫巷女王i 2020-12-30 17:05

I have a docker/jvm instance, which I use from the command line to compile and run java code. IntelliJ\'s project config requires me to point at a jvm on the filesystem.

2条回答
  •  时光说笑
    2020-12-30 18:05

    If you're on a posix system, you can make a simple executable shell script that takes command line argument and forwards those to:

    docker exec [OPTIONS] CONTAINER COMMAND [ARGS...]
    

    This may even work on Windows with a batch file.

    One problem is when you have to pass in file paths. A solution could be to mount the working directory at an identical path in the container, as on the host.

    Don't forget the shebang if you go for a shell script.

    On Windows, a filepath may be 'unixified' in a batch file like this:

    set FILEPATH=%FILEPATH:C:=/c%
    set FILEPATH=%FILEPATH:\=/% 
    

提交回复
热议问题