This repository has been archived by the owner on Nov 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from testforstephen/jinbo_java12
Add java 12 container definition
- Loading branch information
Showing
14 changed files
with
279 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#----------------------------------------------------------------------------------------- | ||
# 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-12 | ||
|
||
# Install git, process tools | ||
RUN yum update -y && yum install -y git procps unzip | ||
|
||
# Install Gradle | ||
ENV GRADLE_HOME /opt/gradle | ||
ENV GRADLE_VERSION 5.4 | ||
ARG GRADLE_DOWNLOAD_SHA256=c8c17574245ecee9ed7fe4f6b593b696d1692d1adbfef425bef9b333e3a0e8de | ||
RUN curl -SL --output gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \ | ||
&& echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum --check - \ | ||
&& unzip gradle.zip \ | ||
&& rm gradle.zip \ | ||
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \ | ||
&& ln -s "${GRADLE_HOME}/bin/gradlec" /usr/bin/gradle | ||
|
||
# Clean yum cache | ||
RUN yum clean all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "Java 12", | ||
"dockerFile": "Dockerfile", | ||
"extensions": [ | ||
"vscjava.vscode-java-pack" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
README.md | ||
test-project | ||
.vscode | ||
.npmignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"type": "java", | ||
"name": "Launch App", | ||
"request": "launch", | ||
"cwd": "${workspaceFolder}/test-project", | ||
"console": "internalConsole", | ||
"stopOnEntry": false, | ||
"mainClass": "com.mycompany.app.App", | ||
"args": "", | ||
"projectName": "my-app" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Java 12 | ||
|
||
## Summary | ||
|
||
*Develop Java applications. Includes the JDK 12, Maven and Gradle build tools.* | ||
|
||
| Metadata | Value | | ||
|----------|-------| | ||
| *Contributors* | The VS Code Java Team | | ||
| *Definition type* | Dockerfile | | ||
| *Languages, platforms* | Java, Maven, Gradle | | ||
|
||
## 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 <kbd>F1</kbd> select and **Remote-Containers: Create Container Configuration File...** from the command palette. | ||
3. Select the Java 12 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-12/.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 <kbd>F1</kbd> 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 <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...** | ||
4. Select the `containers/java-12` folder. | ||
5. After the folder has opened in the container, press <kbd>F5</kbd> to start the project. | ||
6. You should see "Hello Weekday" in the 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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-12"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="target/generated-sources/annotations"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="ignore_optional_problems" value="true"/> | ||
<attribute name="m2e-apt" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="ignore_optional_problems" value="true"/> | ||
<attribute name="m2e-apt" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>my-app</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
2 changes: 2 additions & 0 deletions
2
containers/java-12/test-project/.settings/org.eclipse.jdt.apt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.apt.aptEnabled=false |
9 changes: 9 additions & 0 deletions
9
containers/java-12/test-project/.settings/org.eclipse.jdt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=12 | ||
org.eclipse.jdt.core.compiler.compliance=12 | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=enabled | ||
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=12 |
4 changes: 4 additions & 0 deletions
4
containers/java-12/test-project/.settings/org.eclipse.m2e.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.mycompany.app</groupId> | ||
<artifactId>my-app</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>my-app</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<properties> | ||
<maven.compiler.source>12</maven.compiler.source> | ||
<maven.compiler.target>12</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>3.0.0-M3</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.0</version> | ||
<configuration> | ||
<source>12</source> | ||
<target>12</target> | ||
<compilerArgs>--enable-preview</compilerArgs> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
23 changes: 23 additions & 0 deletions
23
containers/java-12/test-project/src/main/java/com/mycompany/app/App.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/*---------------------------------------------------------------------------------------- | ||
* 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; | ||
|
||
public class App | ||
{ | ||
public static void main( String[] args ) | ||
{ | ||
System.out.println("Hello " + getDay(DAY_OF_WEEK.FRIDAY)); | ||
} | ||
|
||
static String getDay(DAY_OF_WEEK dayOfWeek) { | ||
return switch (dayOfWeek) { | ||
case MONDAY, TUESDAY, WEDNESDAY, THRUSDAY, FRIDAY -> "Weekday"; | ||
case SATURDAY, SUNDAY -> "Weekend"; | ||
}; | ||
} | ||
|
||
static enum DAY_OF_WEEK { MONDAY, TUESDAY, WEDNESDAY, THRUSDAY, FRIDAY, SATURDAY, SUNDAY}; | ||
} |
23 changes: 23 additions & 0 deletions
23
containers/java-12/test-project/src/test/java/com/mycompany/app/AppTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ); | ||
} | ||
} |