пятница, 10 ноября 2017 г.

vscode + Gradle PRJ (min)

build.gradle




apply plugin: 'java'

sourceSets {
   main {
      java {
         srcDir 'src'
      }
   }
    
   test {
      java {
         srcDir 'test'
      }
   }
}

VScode Maven PRJ

  1. First, download Maven and follow the installation instructions and verify your installation
        mvn --version
     
  2. Invoke the maven quickstart archetype to generate your new project.
        mvn archetype:generate
        -DgroupId=com.mycompany.app
        -DartifactId=my-app
        -DarchetypeArtifactId=maven-archetype-quickstart
        -DinteractiveMode=false
     
  3. Start VS Code with the new project
        code ./my-app

четверг, 9 ноября 2017 г.

VSCode Java (debug build run)

task.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "javac",
            "args": [
                "-g",
                "-d",
                "bin",
                "${file}"
            ]
        },
        {
            "label": "run",
            "command": "java",
            "args": [
                "-classpath",
                "./bin",
                "Main"
            ]
        }
    ]
}

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Debug (Launch)",
            "request": "launch",
            "mainClass": "Main",
            "args": "",
            "classPaths": [
                "./bin"
            ]
        },
        {
            "type": "java",
            "name": "Debug (Attach)",
            "request": "attach",
            "hostName": "localhost",
            "port": 0
        }
    ]
}


 

вторник, 10 октября 2017 г.

Maven

MAVEN 
 
  • Зайдите на официальный сайт мавен в раздел загрузка и скачайте последнюю стабильную версию.
  • Распакуйте архив в инсталляционную директорию. Например в C:\Program Files\maven\ в Windows или /opt/maven в Linux
  • Установите переменную окружения M2_HOME:
    В Windows кликните правой кнопкой мыши на "мой компьютер" ->свойства->дополнительные параметры->переменные среды->системные переменные и там добавьте "M2_HOME" и "C:\Program Files\maven\" .
    В Linux можно добавить строку "export M2_HOME=/opt/maven"в файл /etc/profile .
  • Установите переменную окружения PATH В Windows в переменной PATH добавьте к списку директорий строку %M2_HOME%\bin". В Linux можно добавить строку "export PATH=$PATH:$M2_HOME/bin"в файл /etc/profile .
  • Проверьте корректность установки, набрав в командной строке
    mvn -version
     
    JAVA 
    1. The variables defined under System variables are available across all the users of the system, and those defined under User variables for sanaulla are available only to the user, sanaulla.
    2. Click on New under User variables for <your username> to add a new variable, with the name JAVA_HOME, and its value as the location of the JDK 9 installation. For example, it would be C:/Program Files/Java/jdk-9 (for 64 bit) or C:/Program Files (x86)/Java/jdk-9 (for 32 bit):
      1. The next step is to update the PATH environment variable with the location of the bin directory of your JDK installation (defined in the JAVA_HOME environment variable). If you already see the PATH variable defined in the list, then you need to select that variable and click on Edit. If the PATH variable is not seen, then click on New.
      2. Any of the actions in the previous step will give you a popup, as shown in the following screenshot (on Windows 10):
       
    3. You can either click on New in the first picture and insert the value, %JAVA_HOME%/bin, or you can append the value against the Variable value field by adding ; %JAVA_HOME%/bin. The semicolon (;) in Windows is used to separate multiple values for a given variable name.
    4. After setting the values, open the command prompt and then run javac -version, and you should be able to see javac 9-ea as the output. If you don't see it, then it means that the bin directory of your JDK installation has not been correctly added to the PATH variable.