diff --git a/containers/java-11-maven/.devcontainer/Dockerfile b/containers/java-11-maven/.devcontainer/Dockerfile new file mode 100644 index 0000000000..11790d1e37 --- /dev/null +++ b/containers/java-11-maven/.devcontainer/Dockerfile @@ -0,0 +1,15 @@ +#----------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE in the project root for license information. +#----------------------------------------------------------------------------------------- + +FROM maven:3-jdk-11 + +# Install git, process tools +RUN apt-get update && apt-get -y install git procps + +# Clean up +RUN apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + \ No newline at end of file diff --git a/containers/java-11-maven/.devcontainer/devcontainer.json b/containers/java-11-maven/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..472018878c --- /dev/null +++ b/containers/java-11-maven/.devcontainer/devcontainer.json @@ -0,0 +1,8 @@ +{ + "name": "Java 11 & Maven", + "dockerFile": "Dockerfile", + "extensions": [ + "vscjava.vscode-java-pack", + "redhat.vscode-xml" + ] +} diff --git a/containers/java-11-maven/.npmignore b/containers/java-11-maven/.npmignore new file mode 100644 index 0000000000..1d72d293eb --- /dev/null +++ b/containers/java-11-maven/.npmignore @@ -0,0 +1,4 @@ +README.md +test-project +.vscode +.npmignore diff --git a/containers/java-11-maven/.vscode/launch.json b/containers/java-11-maven/.vscode/launch.json new file mode 100644 index 0000000000..143450a24a --- /dev/null +++ b/containers/java-11-maven/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + "configurations": [ + { + "type": "java", + "name": "Launch App", + "request": "launch", + "cwd": "${workspaceFolder}/test-project", + "console": "internalConsole", + "stopOnEntry": false, + "mainClass": "mymodule/com.mycompany.app.App", + "args": "", + "projectName": "my-app" + } + ] +} \ No newline at end of file diff --git a/containers/java-11-maven/README.md b/containers/java-11-maven/README.md new file mode 100644 index 0000000000..6c3f1b4aa5 --- /dev/null +++ b/containers/java-11-maven/README.md @@ -0,0 +1,55 @@ +# Java 11 & Maven + +## Summary + +*Develop Java applications. Includes the JDK 11, XML tools, along with any dependencies Maven requires.* + +| Metadata | Value | +|----------|-------| +| *Contributors* | The VS Code Java Team | +| *Definition type* | Dockerfile | +| *Languages, platforms* | Java, Maven | + +## Using this definition with an existing folder + +Note that only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used. + +```json +"console": "integratedTerminal" +``` + +Beyond that, just follow these steps to use the definition: + +1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine. + +2. To use VS Code's copy of this definition: + 1. Start VS Code and open your project folder. + 2. Press F1 select and **Remote-Containers: Create Container Configuration File...** from the command palette. + 3. Select the Java 11 & Maven definition. + +3. To use latest-and-greatest copy of this definition from the repository: + 1. Clone this repository. + 2. Copy the contents of `containers/java-11-maven/.devcontainer` to the root of your project folder. + 3. Start VS Code and open your project folder. + +4. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs. + +5. Finally, press F1 and run **Remote-Containers: Reopen Folder in Container** to start using the definition. + +## Testing the definition + +This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps: + +1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine. +2. Clone this repository. +3. Start VS Code, press F1, and select **Remote-Containers: Open Folder in Container...** +4. Select the `containers/java-11-maven` folder. +5. After the folder has opened in the container, press F5 to start the project. +6. You should see "Hello Remote World!" in the a Debug Console after the program executes. +7. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing. + +## License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE). diff --git a/containers/java-11-maven/test-project/.classpath b/containers/java-11-maven/test-project/.classpath new file mode 100644 index 0000000000..9ba41a249e --- /dev/null +++ b/containers/java-11-maven/test-project/.classpath @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/containers/java-11-maven/test-project/.gitignore b/containers/java-11-maven/test-project/.gitignore new file mode 100644 index 0000000000..1de565933b --- /dev/null +++ b/containers/java-11-maven/test-project/.gitignore @@ -0,0 +1 @@ +target \ No newline at end of file diff --git a/containers/java-11-maven/test-project/.project b/containers/java-11-maven/test-project/.project new file mode 100644 index 0000000000..c71226c8d5 --- /dev/null +++ b/containers/java-11-maven/test-project/.project @@ -0,0 +1,23 @@ + + + my-app + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/containers/java-11-maven/test-project/.settings/org.eclipse.jdt.apt.core.prefs b/containers/java-11-maven/test-project/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 0000000000..d4313d4b25 --- /dev/null +++ b/containers/java-11-maven/test-project/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/containers/java-11-maven/test-project/.settings/org.eclipse.jdt.core.prefs b/containers/java-11-maven/test-project/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..46235dc078 --- /dev/null +++ b/containers/java-11-maven/test-project/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/containers/java-11-maven/test-project/.settings/org.eclipse.m2e.core.prefs b/containers/java-11-maven/test-project/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000000..f897a7f1cb --- /dev/null +++ b/containers/java-11-maven/test-project/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/containers/java-11-maven/test-project/pom.xml b/containers/java-11-maven/test-project/pom.xml new file mode 100644 index 0000000000..3e1e5dba96 --- /dev/null +++ b/containers/java-11-maven/test-project/pom.xml @@ -0,0 +1,45 @@ + + 4.0.0 + com.mycompany.app + my-app + jar + 1.0-SNAPSHOT + my-app + http://maven.apache.org + + + 11 + 11 + + + + + junit + junit + 4.12 + test + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M3 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 11 + 11 + + + + + + diff --git a/containers/java-11-maven/test-project/src/main/java/com/mycompany/app/App.java b/containers/java-11-maven/test-project/src/main/java/com/mycompany/app/App.java new file mode 100644 index 0000000000..15d9aba0c4 --- /dev/null +++ b/containers/java-11-maven/test-project/src/main/java/com/mycompany/app/App.java @@ -0,0 +1,17 @@ +/*---------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See LICENSE in the project root for license information. + *---------------------------------------------------------------------------------------*/ + +package com.mycompany.app; + +import static javax.xml.XMLConstants.XML_NS_PREFIX; + +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello Remote World!" ); + System.out.println("The XML namespace prefix is: " + XML_NS_PREFIX); + } +} diff --git a/containers/java-11-maven/test-project/src/main/java/module-info.java b/containers/java-11-maven/test-project/src/main/java/module-info.java new file mode 100644 index 0000000000..602319b2b0 --- /dev/null +++ b/containers/java-11-maven/test-project/src/main/java/module-info.java @@ -0,0 +1,4 @@ +module mymodule { + requires java.base; + requires java.xml; +} \ No newline at end of file diff --git a/containers/java-11-maven/test-project/src/test/java/com/mycompany/app/AppTest.java b/containers/java-11-maven/test-project/src/test/java/com/mycompany/app/AppTest.java new file mode 100644 index 0000000000..a315bb5b36 --- /dev/null +++ b/containers/java-11-maven/test-project/src/test/java/com/mycompany/app/AppTest.java @@ -0,0 +1,23 @@ +package com.mycompany.app; + +import org.junit.Test; +import static org.junit.Assert.*; + + +public class AppTest +{ + public AppTest() { + } + + @Test + public void testApp() + { + assertTrue( true ); + } + + @Test + public void testMore() + { + assertTrue( true ); + } +}