Compare commits
11 Commits
7f7edfa4a4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| abe822f796 | |||
|
|
4638a92503 | ||
|
|
4f20aa36f9 | ||
|
|
e3853a50e6 | ||
|
|
d209c5e64c | ||
|
|
3744b48f29 | ||
|
|
31f49a02e7 | ||
|
|
d60d51c56c | ||
|
|
80c46f196b | ||
|
|
f7974a3305 | ||
|
|
663739ec15 |
13
.classpath
13
.classpath
@@ -31,6 +31,19 @@
|
|||||||
<attribute name="m2e-apt" value="true"/>
|
<attribute name="m2e-apt" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/blob/main/containers/java/.devcontainer/base.Dockerfile
|
|
||||||
# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 8, 11, 17, 8-bullseye, 11-bullseye, 17-bullseye, 8-buster, 11-buster, 17-buster
|
|
||||||
ARG VARIANT=11-bullseye
|
|
||||||
FROM mcr.microsoft.com/vscode/devcontainers/java:${VARIANT}
|
|
||||||
|
|
||||||
# [Option] Install Maven
|
|
||||||
ARG INSTALL_MAVEN="false"
|
|
||||||
ARG MAVEN_VERSION=""
|
|
||||||
# [Option] Install Gradle
|
|
||||||
ARG INSTALL_GRADLE="false"
|
|
||||||
ARG GRADLE_VERSION=""
|
|
||||||
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
|
||||||
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
|
||||||
|
|
||||||
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
|
|
||||||
ARG NODE_VERSION="none"
|
|
||||||
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
|
||||||
|
|
||||||
# [Optional] Uncomment this section to install additional OS packages.
|
|
||||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
|
||||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
|
||||||
|
|
||||||
# [Optional] Uncomment this line to install global node packages.
|
|
||||||
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
|
||||||
@@ -1,37 +1,29 @@
|
|||||||
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/java
|
// README at: https://github.com/devcontainers/templates/tree/main/src/java
|
||||||
{
|
{
|
||||||
"name": "Java",
|
"name": "Java",
|
||||||
"build": {
|
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||||
"dockerfile": "Dockerfile",
|
"image": "mcr.microsoft.com/devcontainers/java:1-21",
|
||||||
"args": {
|
|
||||||
// Update the VARIANT arg to pick a Java version: 8, 11, 17
|
"features": {
|
||||||
// Append -bullseye or -buster to pin to an OS version.
|
"ghcr.io/devcontainers/features/java:1": {
|
||||||
// Use the -bullseye variants on local arm64/Apple Silicon.
|
"version": "none",
|
||||||
"VARIANT": "17-bullseye",
|
"installMaven": "true",
|
||||||
// Options
|
"mavenVersion": "3.8.6",
|
||||||
"INSTALL_MAVEN": "true",
|
"installGradle": "false"
|
||||||
"MAVEN_VERSION": "3.8.5",
|
|
||||||
"INSTALL_GRADLE": "false",
|
|
||||||
"NODE_VERSION": "lts/*"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Configure tool-specific properties.
|
// Configure tool-specific properties.
|
||||||
"customizations": {
|
"customizations": {
|
||||||
// Configure properties specific to VS Code.
|
// Configure properties specific to VS Code.
|
||||||
"vscode": {
|
"vscode": {
|
||||||
// Set *default* container specific settings.json values on container create.
|
"settings": {},
|
||||||
"settings": {
|
|
||||||
"maven.executable.path": "/usr/local/sdkman/candidates/maven/current/bin/mvn"
|
|
||||||
},
|
|
||||||
|
|
||||||
// Add the IDs of extensions you want installed when the container is created.
|
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"vscjava.vscode-java-pack"
|
"streetsidesoftware.code-spell-checker"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
// "forwardPorts": [],
|
// "forwardPorts": [],
|
||||||
@@ -39,6 +31,6 @@
|
|||||||
// Use 'postCreateCommand' to run commands after the container is created.
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
// "postCreateCommand": "java -version",
|
// "postCreateCommand": "java -version",
|
||||||
|
|
||||||
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
"remoteUser": "vscode"
|
// "remoteUser": "root"
|
||||||
}
|
}
|
||||||
|
|||||||
7
.gitea/dependabot.yml
Normal file
7
.gitea/dependabot.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# For more details, see https://containers.dev/guide/dependabot
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "devcontainers"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
11
.project
11
.project
@@ -20,4 +20,15 @@
|
|||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
|
<filteredResources>
|
||||||
|
<filter>
|
||||||
|
<id>1760434241527</id>
|
||||||
|
<name></name>
|
||||||
|
<type>30</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||||
|
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
</filteredResources>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|||||||
4
.settings/org.eclipse.core.resources.prefs
Normal file
4
.settings/org.eclipse.core.resources.prefs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/test/java=UTF-8
|
||||||
|
encoding/<project>=UTF-8
|
||||||
9
CODE_OF_CONDUCT.md
Normal file
9
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Microsoft Open Source Code of Conduct
|
||||||
|
|
||||||
|
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||||
|
|
||||||
|
Resources:
|
||||||
|
|
||||||
|
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
|
||||||
|
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
||||||
|
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
|
||||||
37
README.md
37
README.md
@@ -1,8 +1,8 @@
|
|||||||
# Try Out Development Containers: Java
|
# Try Out Development Containers: Java
|
||||||
|
|
||||||
[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode-remote-try-java)
|
[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode-remote-try-java)
|
||||||
|
|
||||||
A **development container** is a running [Docker](https://www.docker.com) container with a well-defined tool/runtime stack and its prerequisites. You can try out development containers with **[GitHub Codespaces](https://github.com/features/codespaces)** or **[Visual Studio Code Remote - Containers](https://aka.ms/vscode-remote/containers)**.
|
A **development container** is a running container with a well-defined tool/runtime stack and its prerequisites. You can try out development containers with **[GitHub Codespaces](https://github.com/features/codespaces)** or **[Visual Studio Code Dev Containers](https://aka.ms/vscode-remote/containers)**.
|
||||||
|
|
||||||
This is a sample project that lets you try out either option in a few easy steps. We have a variety of other [vscode-remote-try-*](https://github.com/search?q=org%3Amicrosoft+vscode-remote-try-&type=Repositories) sample projects, too.
|
This is a sample project that lets you try out either option in a few easy steps. We have a variety of other [vscode-remote-try-*](https://github.com/search?q=org%3Amicrosoft+vscode-remote-try-&type=Repositories) sample projects, too.
|
||||||
|
|
||||||
@@ -12,53 +12,64 @@ This is a sample project that lets you try out either option in a few easy steps
|
|||||||
|
|
||||||
### GitHub Codespaces
|
### GitHub Codespaces
|
||||||
Follow these steps to open this sample in a Codespace:
|
Follow these steps to open this sample in a Codespace:
|
||||||
1. Click the Code drop-down menu and select the **Open with Codespaces** option.
|
1. Click the **Code** drop-down menu.
|
||||||
1. Select **+ New codespace** at the bottom on the pane.
|
2. Click on the **Codespaces** tab.
|
||||||
|
3. Click **Create codespace on main**.
|
||||||
|
|
||||||
For more info, check out the [GitHub documentation](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace#creating-a-codespace).
|
For more info, check out the [GitHub documentation](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace#creating-a-codespace).
|
||||||
|
|
||||||
### VS Code Remote - Containers
|
### VS Code Dev Containers
|
||||||
|
|
||||||
If you already have VS Code and Docker installed, you can click the badge above or [here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode-remote-try-java) to get started. Clicking these links will cause VS Code to automatically install the Remote - Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
|
If you already have VS Code and Docker installed, you can click the badge above or [here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode-remote-try-java) to get started. Clicking these links will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
|
||||||
|
|
||||||
Follow these steps to open this sample in a container using the VS Code Remote - Containers extension:
|
Follow these steps to open this sample in a container using the VS Code Dev Containers extension:
|
||||||
|
|
||||||
1. If this is your first time using a development container, please ensure your system meets the pre-reqs (i.e. have Docker installed) in the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started).
|
1. If this is your first time using a development container, please ensure your system meets the pre-reqs (i.e. have Docker installed) in the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started).
|
||||||
|
|
||||||
2. To use this repository, you can either open the repository in an isolated Docker volume:
|
2. To use this repository, you can either open the repository in an isolated Docker volume:
|
||||||
|
|
||||||
- Press <kbd>F1</kbd> and select the **Remote-Containers: Try a Sample...** command.
|
- Press <kbd>F1</kbd> and select the **Dev Containers: Try a Sample...** command.
|
||||||
- Choose the "Java" sample, wait for the container to start, and try things out!
|
- Choose the "Java" sample, wait for the container to start, and try things out!
|
||||||
> **Note:** Under the hood, this will use the **Remote-Containers: Clone Repository in Container Volume...** command to clone the source code in a Docker volume instead of the local filesystem. [Volumes](https://docs.docker.com/storage/volumes/) are the preferred mechanism for persisting container data.
|
> **Note:** Under the hood, this will use the **Dev Containers: Clone Repository in Container Volume...** command to clone the source code in a Docker volume instead of the local filesystem. [Volumes](https://docs.docker.com/storage/volumes/) are the preferred mechanism for persisting container data.
|
||||||
|
|
||||||
Or open a locally cloned copy of the code:
|
Or open a locally cloned copy of the code:
|
||||||
|
|
||||||
- Clone this repository to your local filesystem.
|
- Clone this repository to your local filesystem.
|
||||||
- Press <kbd>F1</kbd> and select the **Remote-Containers: Open Folder in Container...** command.
|
- Press <kbd>F1</kbd> and select the **Dev Containers: Open Folder in Container...** command.
|
||||||
- Select the cloned copy of this folder, wait for the container to start, and try things out!
|
- Select the cloned copy of this folder, wait for the container to start, and try things out!
|
||||||
|
|
||||||
## Things to try
|
## Things to try
|
||||||
|
|
||||||
Once you have this sample opened, you'll be able to work with it like you would locally.
|
Once you have this sample opened, you'll be able to work with it like you would locally.
|
||||||
|
|
||||||
> **Note:** This container runs as a non-root user with sudo access by default. Comment out `"remoteUser": "vscode"` in `.devcontainer/devcontainer.json` if you'd prefer to run as root.
|
|
||||||
|
|
||||||
Some things to try:
|
Some things to try:
|
||||||
|
|
||||||
1. **Edit:**
|
1. **Edit:**
|
||||||
- Open `src/main/java/com/mycompany/app/App.java`.
|
- Open `src/main/java/com/mycompany/app/App.java`.
|
||||||
- Try adding some code and check out the language features.
|
- Try adding some code and check out the language features.
|
||||||
- Notice that the Java extension pack is already installed in the container since the `.devcontainer/devcontainer.json` lists `"vscjava.vscode-java-pack"` as an extension to install automatically when the container is created.
|
- Make a spelling mistake and notice it is detected. The [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) extension was automatically installed because it is referenced in `.devcontainer/devcontainer.json`.
|
||||||
|
- Also notice that the [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) is installed. The JDK is in the `mcr.microsoft.com/devcontainers/java` image and Dev Container settings and metadata are automatically picked up from [image labels](https://containers.dev/implementors/reference/#labels).
|
||||||
|
|
||||||
2. **Terminal:** Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>\`</kbd> and type `uname` and other Linux commands from the terminal window.
|
2. **Terminal:** Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>\`</kbd> and type `uname` and other Linux commands from the terminal window.
|
||||||
|
|
||||||
3. **Build, Run, and Debug:**
|
3. **Build, Run, and Debug:**
|
||||||
- Open `src/main/java/com/mycompany/app/App.java`.
|
- Open `src/main/java/com/mycompany/app/App.java`.
|
||||||
- Add a breakpoint.
|
- Add a breakpoint.
|
||||||
- Press <kbd>F5</kbd> to launch the app in the container.
|
- Press <kbd>F5</kbd> to launch the app in the container.
|
||||||
- Once the breakpoint is hit, try hovering over variables, examining locals, and more.
|
- Once the breakpoint is hit, try hovering over variables, examining locals, and more.
|
||||||
|
|
||||||
4. **Run a Test:**
|
4. **Run a Test:**
|
||||||
- Open `src/test/java/com/mycompany/app/AppTest.java`.
|
- Open `src/test/java/com/mycompany/app/AppTest.java`.
|
||||||
- Put a breakpoint in a test.
|
- Put a breakpoint in a test.
|
||||||
- Click the `Debug Test` in the Code Lens above the function and watch it hit the breakpoint.
|
- Click the `Debug Test` in the Code Lens above the function and watch it hit the breakpoint.
|
||||||
|
|
||||||
|
5. **Install Node.js using a Dev Container Feature:**
|
||||||
|
- Press <kbd>F1</kbd> and select the **Dev Containers: Configure Container Features...** or **Codespaces: Configure Container Features...** command.
|
||||||
|
- Type "node" in the text box at the top.
|
||||||
|
- Check the check box next to "Node.js (via nvm) and yarn" (published by devcontainers)
|
||||||
|
- Click OK
|
||||||
|
- Press <kbd>F1</kbd> and select the **Dev Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up.
|
||||||
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|||||||
41
SECURITY.md
Normal file
41
SECURITY.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
||||||
|
|
||||||
|
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
|
||||||
|
|
||||||
|
## Reporting Security Issues
|
||||||
|
|
||||||
|
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||||
|
|
||||||
|
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
|
||||||
|
|
||||||
|
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
|
||||||
|
|
||||||
|
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
|
||||||
|
|
||||||
|
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||||
|
|
||||||
|
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||||
|
* Full paths of source file(s) related to the manifestation of the issue
|
||||||
|
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||||
|
* Any special configuration required to reproduce the issue
|
||||||
|
* Step-by-step instructions to reproduce the issue
|
||||||
|
* Proof-of-concept or exploit code (if possible)
|
||||||
|
* Impact of the issue, including how an attacker might exploit the issue
|
||||||
|
|
||||||
|
This information will help us triage your report more quickly.
|
||||||
|
|
||||||
|
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
|
||||||
|
|
||||||
|
## Preferred Languages
|
||||||
|
|
||||||
|
We prefer all communications to be in English.
|
||||||
|
|
||||||
|
## Policy
|
||||||
|
|
||||||
|
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
|
||||||
|
|
||||||
|
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
||||||
@@ -8,5 +8,6 @@ package com.mycompany.app;
|
|||||||
public class App {
|
public class App {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("Hello Remote World!");
|
System.out.println("Hello Remote World!");
|
||||||
|
System.out.println("Hello");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user