class SampleSpec extends Specification {
def "where with variables: #size"() {
when:
def list = new ArrayList(size)
then:
list.size() == 0
where:
size << [1, 2, 3, 4, 5]
}
def "using data tables for calculating max, Max of #a and #b is #max"() {
expect:
Math.max(a, b) == max
where:
a | b || max
1 | 2 || 2
7 | 4 || 7
0 | 0 || 0
}
}
실행을 해보았더니 아래와 같은 에러가 발생했습니다.
Internal Error occurred.
org.junit.platform.commons.JUnitException: TestEngine with ID 'spock' failed to discover tests
...중략...
Caused by: org.junit.platform.commons.JUnitException: ClassSelector [className = 'com.project.SampleSpec', classLoader = null] resolution failed
...중략...
Caused by: org.junit.platform.commons.PreconditionViolationException: Could not load class with name: com.project.SampleSpec
...중략...
Caused by: java.lang.ClassNotFoundException: com.project.SampleSpec
구글링 결과 build.gradle 파일의 plugins 에 id 'groovy' 를 추가해주면 되는 문제였습니다.
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.1'
id 'io.spring.dependency-management' version '1.1.4'
id 'groovy' <-- 이게 있는지 확인
}
최근 2년정도 IntelliJ에서 Java 11 기반의 AWS Correto 11 을 사용해왔습니다
그래서 현재 JAVA_HOME 은 AWS Correto 11 의 위치를 가리키고 있었습니다.
신규 프로젝트 구성할 일이 생겼고
AWS Correto 17 을 미리 다운받아둔 상태에서
IntelliJ 에서 SpringBoot Initializer 를 이용해서
아래와 같은 설정(Java 17 + gradle groovy)으로 프로젝트를 생성하고
빌드를 하니 오류가 발생했습니다.
아래는 빌드시 발생했던 오류 메시지
A problem occurred configuring root project 'my-new-springboot3-project'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.2.1.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.1
> No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.2.1 was found. The consumer was configured to find a library for use during runtime, compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.5' but:
- Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
- Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
- Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.1 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
- Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.1 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
- Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
- Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 1s
에러 메시지의 내용을 읽어보니, 일단 Could not resolve xxx 의 경우 xxx 라이브러리가 없다라는 메시지인데
신규 생성한 프로젝트에서 필수라이브러리를 dependency에 안넣을 이유가 없다는 생각이 우선 들었습니다.
그런거라면 springboot initializer 의 버그일테니까요.
그래서 더 읽어봤습니다.
그리고 "requierd compatibility with Java 11" 문구가 눈에 띄었습니다.
난 자바17을 쓰려고 17버전으로 JDK와 Java 설정을 넣었는데 왜 Java 11 관련메시지가 뜨는건지 이상했습니다. 🤔
에러메시지 내용으로 구글링을 좀 해보니 아래 부분들을 확인해보라는 내용들이 있었습니다.
현재 시스템에서 사용하는 Java 버전 확인 (java -version)
build.gradle 파일의 sourceCompatibility 확인
IntelliJ 의 project SDK 설정 확인
gradle JVM 설정 확인
일단 빌드시에 발생했고, 빌드툴은 gradle 이라는 걸 이미 프로젝트 생성시 설정을 해주었고, IntelliJ에 gradle 이 사용할 자바버전을 설정하는 내용이 있다는 것을 알고있었기에 gradle JVM 설정을 먼저 확인해봤습니다.
gradle JVM 설정이 기존 설정 그대로 Java 11을 사용하도록 되어있었습니다. 😭
프로젝트 생성시 correto 17, Java 17 버전을 설정해주었기에 sourceCompatibility 와 project SDK 는 17버전을 사용하도록 되어있었고, JAVA_HOME에 설정되어있는 현재 시스템에서 기본으로 사용중인 Java 버전과는 관계가 없었습니다.
fasterxml.jackson.databind.PropertyNamingStrategy -> PropertyNamingStrategies 클래스 변경
third-party dependency 들 중에서 업그레이드가 필요한 것들 확인 및 업그레이드
gradle 버전 업그레이드 6.7 -> 6.9
작업 내용만보면 진짜 별거 아니었던 작업으로 보이네요. 작업시간보다 문서 읽어보는 시간이 더 오래 걸렸던것 같습니다. 링크를 타고타고 들어가야 확인할 수 있는 것들이 많다보니..
아무튼 로컬환경에서 잘 돌아가는 것까지 확인 하고 개발에 올려 테스트를 해보니 애플리케이션이 정상적으로 실행되지 못하는 현상이 확인되었습니다. 왜 그런가 봤더니 jar 파일명이 이상하게 바뀌어있었습니다. 끝에 -plain postfix가 붙은 파일명이 배포된 것을 확인했고 이게 뭔가 싶어 구글링을 해보니 release note 에서 설명을 찾아볼 수 없었지만(내가 못 본 걸수도?) 2.5버전부터 발생하는 현상이었고 gradle 설정에서 jar task를 비활성화 시키거나 배포파일을 만드는 task 에서 해당 파일을 exclude 처리하면 되는 문제였습니다.
매일 반복되는 특별하지 않은 업무들만 하다가 처음으로 해본 프레임워크 업그레이드 작업은 너무 재미있었고 좋은 경험이었습니다.
내년에는 java 17 + SpringBoot 3 기반의 신규 프로젝트를 하나 만들어야 하는데 벌써부터 기대되고 현재 사용중인 java 11 에서 17까지 어떤 변화들이 있었는지 확인하는 시간을 가져야 할 것 같습니다.
요즘 flutter & flame 으로 1인게임 개발을 진행하고 있는데 알아야 할게 너무나도 많아 문서 찾아보고 유툽 영상 찾아보면서 얕은 지식을 조금씩 조금씩 모으다가 지겨워져서 엊그제 하루 날 잡아서 퇴근하고 밤새워 구글링해가면서 만들어봤습니다.
인트로 화면도 로비화면도 없고 그냥 모기 날아다니게 만들고 터치하면 HP 줄어들면서 사라지고 단계별로 정해진 모기들을 모두 잡으면 다음 단계로 넘어가도록 했습니다. 아래는 샘플 영상입니다.
원래 단계별로 일정 마리수의 모기가 나오도록 해놓았으나 단계별로 모기마리수를 제외하면 특별할게 없어서 단계당 한마리씩만 출몰하도록 설정을 변경한 뒤 녹화했습니다. 단계별로 모기의 HP도 늘어납니다. ㅎㅎ
아직 해야할게 많이 있지만 중간중간 기록을 위해 포스팅합니다.
앞으로 해야할 것들은... HP바 만들기... 유저 로그인 및 최종게임상태 저장하기, 리더보드, 모기의 유저공격 기능, 유저 및 모기 공격력, 장비&스킬, 보스급모기, 보스출현시 애니메이션 등등 기획하기 및 그림그리기 등등... 너무 많이 있지만 천천히 끝까지 가보려고 합니다 ㅎ
아래 영상은 첫 날 설치해서 실행해본 데모앱의 내용을 다 지우고 처음부터 작성하면서 화면 이동, 각종 버튼 추가, 그리고 버튼에 이벤트 핸들링 기능을 넣어보는 기초적인 부분에 대해서 빠르게 가르쳐 주고있습니다. 처음 플러터를 접하는 분들에게 딱 좋은 영상인것 같아서 공유합니다.
그리고 플러터 공식문서에서도 Cookbook 에서 기본적으로 필요한 기능들에대해 어떻게 구현해야하는지 예제샘플들을 갖추고 있고, codelab 이라는 단계별 따라해보기와 같은 자료도 제공해주고 있습니다. 코드랩을 따라해보면 앱을 개발할때 어떻게 개발이 진행되는지 그 순서도 배울 수 있습니다.
객체지향 언어이고 변수, loop, 메서드, 클래스 등등 매우 많은 부분에서 유사한 점을 보이고 있음.
자바와 다트의 차이점을 나열해보자면..다트는 아래와 같은 특징 또는 기능이 있습니다.
primitive(원시) 타입이 없음. 자바의 경우 int, long, double 과 같은 원시타입과 이 원시타입들의 wrapper 클래스인 Integer, Long, Double 등이 존재하지만, 다트는 모든 타입이 Object 임.
변수 사용법 (출력시 문자열을 "이걸 출력할건데 변수명을 붙였어요 $변수명" 이렇게 써주면 $변수명 이 변수가 들고있는 값으로 치환되어 출력됨. 자바의 경우 String.format 을 이용해야 했음), 변수명 자리에 {expression} 을 사용하여 계산식을 사용할 수도 있음
null safety (Dart 2.12 버전부터 생김. 자바의 NPE 예방을 개발자가 아닌 컴파일러가 해주도록 한 기능으로 기본적으로 모든 객체는 non-nullable 로 취급함. 다만 ? 기호를 이용해서 nullable 객체라고 명시적으로 선언하면 null 값도 사용할 수 있음, 공식문서 참고)
private, protected, public, default 같은 접근제한자(access modifier)가 없음. 다만 이름이 밑줄로 시작하면 해당 라이브러리(클래스?)에 private한 것이 됨.
다트의 int 타입은 64 비트 signed 값이고 플랫폼에 따라 범위가 약간 다름 (공식문서)
뭐 이외에도 lexical scope, lexical closure 등 여러 부분에서 다른 부분들이 보였는데 여기 다 나열할 수는 없고,
전체적인 느낌은 자바와 자바스크립트를 합쳐놓은 언어라는 느낌을 받았습니다. (해본게 Java랑 Javascript 뿐이라.. ㅎ)
Password:
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
2023-01-18 17:11:11.031 softwareupdate[62998:409413] Package Authoring Error: 012-92132: Package reference com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute
Install of Rosetta 2 finished successfully
뭔가 에러가 났는데 성공적으로 설치했다고 나오네요 !?
2. flutter docter
아래처럼 이쁘게도 분석 결과를 보여주는군요
일단 X표시가 뜬 것들을 설치해야겠어요..
안드로이드 스튜디오 설치 및 최초실행하여 sdk 다운로드, 라이센트 동의, cli tool 설치 등 완료
Xcode 설치 완료 및 라이센스 관련 오류 해결
현재 CocoaPods 이슈와 안드로이드 스튜디오에서 번들자바가 없다는 warning만 남기고 해결.
VS Code 를 IDE로 선택해서 테스트앱 생성, 실행 및 수정하여 hot reload 까지 확인완료.