반응형
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project homepage: Input length = 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project homepage: Input length = 1
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Input length = 1
    at org.apache.maven.plugins.resources.ResourcesMojo.execute (ResourcesMojo.java:362)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: org.apache.maven.shared.filtering.MavenFilteringException: Input length = 1
    at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile (DefaultMavenFileFilter.java:113)
    at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources (DefaultMavenResourcesFiltering.java:262)
    at org.apache.maven.plugins.resources.ResourcesMojo.execute (ResourcesMojo.java:356)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: java.nio.charset.MalformedInputException: Input length = 1
    at java.nio.charset.CoderResult.throwException (CoderResult.java:274)
    at sun.nio.cs.StreamDecoder.implRead (StreamDecoder.java:339)
    at sun.nio.cs.StreamDecoder.read (StreamDecoder.java:178)
    at java.io.InputStreamReader.read (InputStreamReader.java:181)
    at java.io.BufferedReader.read1 (BufferedReader.java:210)
    at java.io.BufferedReader.read (BufferedReader.java:287)
    at java.io.BufferedReader.fill (BufferedReader.java:161)
    at java.io.BufferedReader.read (BufferedReader.java:182)
    at org.apache.maven.shared.filtering.BoundedReader.read (BoundedReader.java:85)
    at org.apache.maven.shared.filtering.MultiDelimiterInterpolatorFilterReaderLineEnding.read (MultiDelimiterInterpolatorFilterReaderLineEnding.java:235)
    at org.apache.maven.shared.filtering.MultiDelimiterInterpolatorFilterReaderLineEnding.read (MultiDelimiterInterpolatorFilterReaderLineEnding.java:197)
    at java.io.Reader.read (Reader.java:189)
    at org.apache.maven.shared.utils.io.FileUtils.copyFile (FileUtils.java:1931)
    at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile (DefaultMavenFileFilter.java:98)
    at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources (DefaultMavenResourcesFiltering.java:262)
    at org.apache.maven.plugins.resources.ResourcesMojo.execute (ResourcesMojo.java:356)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

 

 

다음과 같이 maven 에 추가 한다. 혹시 3.2.0 버전 사용시 -> 3.1.0 낮춰서 테스트 해보면 됨.

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-resources-plugin</artifactId>
	<version>3.1.0</version>
</plugin>
반응형

'Java' 카테고리의 다른 글

tomcat8 cookie 관련  (0) 2022.05.06
lombok mapstruct 설정  (0) 2021.12.15
Log4j && Sl4j  (0) 2021.07.05
spring.jpa.hibernate.ddl-auto, jpa ddl 생성전략  (0) 2021.07.05
jpa - @Transient annotation  (0) 2021.07.05
블로그 이미지

visualp

c#, java

,

Log4j && Sl4j

Java 2021. 7. 5. 13:40
반응형

 - slf4j는 자바 로깅 시스템을 쉽게 사용할 수 있도록 해주는 라이브러리입니다.

 - 다양한 자바 로깅 시스템을 사용할 수 있도록 추상화를 통해 로깅 기능을 제공합니다. 

 

# slf4j를 사용함으로서 얻을 수 있는 이점

 - 기존에 사용하는 로깅 시스템을 교체하고 싶을 때, 소스 코드를 수정하지 않고도 maven이나 gradle의 의존성 설정만 바꾸면 손쉽게  적 

   용할  수 있습니다. 

 

log4j2 연동

<dependencies>
  <dependency>
  <groupId>org.apache.logging.log4j</groupId>
  <artifactId>log4j-slf4j-impl</artifactId>
  <version>2.10.0</version>
  </dependency>
</dependencies>

 

log4j2.xml

<?xml version="1.0" encoding="UTF-8"?>
 
<configuration status="DEBUG">
 
    <Appenders>
        <!-- 콜솔 -->
        <Console name="console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{yyyy-MM-dd hh:mm:ss} %5p [%c] %m%n"/>
        </Console>
        
        <!-- 파일  -->
        <RollingFile name ="RollingFile">
            <FileName>C:/log/mylog.txt</FileName>
            <FilePattern>C:/log/%d{yyyy-MM-dd-hh-mm}/mylog.zip</FilePattern>
            <PatternLayout>
                <Pattern>%d{yyyy-MM-dd HH:mm:ss} %5p [%c] %m%n</Pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval = "1" modulate = "true"/>
            </Policies>
        </RollingFile>
        
        <RollingFile name ="RollingFileError">
            <FileName>C:/log/mylog_error.txt</FileName>
            <FilePattern>C:/log/%d{yyyy-MM-dd-hh-mm}/mylog_error.zip</FilePattern>
            <PatternLayout>
                <Pattern>%d{yyyy-MM-dd HH:mm:ss} %5p [%c] %m%n</Pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval = "1" modulate = "true"/>
            </Policies>
        </RollingFile>
        
    </Appenders>
    
    <loggers>
        <root level="debug" additivity="true">
            <AppenderRef ref="console"/>
            <AppenderRef ref="RollingFile"/>
            <AppenderRef ref="RollingFileError" level = "ERROR"/>
        </root>
    </loggers>
    
</configuration> 

 

logback 연동

<dependency>
  <groupId>ch.qos.logback</groupId>
  <artifactId>logback-classic</artifactId>
  <version>1.2.3</version>
</dependency>

 

 

 

반응형
블로그 이미지

visualp

c#, java

,
반응형
  • none: No change to the database structure. (실서버 운영시 기본값)
  • update: Hibernate changes the database according to the given Entity structures. - 변경된 스키마만 적용한다.
  • validate: 변경된 스키마가 있는지 확인만 한다. 만약 변경이 있다면 Application을 종료한다.
  • create: Creates the database every time, but don’t drop it when close. - 시작될 때만 drop하고 다시 생성한다.
  • create-drop: Creates the database then drops it when the SessionFactory closes. - 시작과 종료에서 모두 drop한다.
반응형
블로그 이미지

visualp

c#, java

,

jpa - @Transient annotation

Java 2021. 7. 5. 11:35
반응형

데이터베이스 테이블에 컬럼이 생성되지 않는 필드 경우 사용합니다. 

ex)  - 게시판의 comment count 구할 떄

반응형
블로그 이미지

visualp

c#, java

,
반응형

#hibernate가 키생성방식을 결정

@GeneratedValue(stategy=GenerationType.AUTO)

 

# 사용하는 databases 가 키생성방식을 결정

@GeneratedValue(stategy=GenerationType.IDENTITY)

 - oracle -> 별도의 번호를 위한 table 생성

 - mysql or mariadb -> Auto Incremnet default

 

#SECUENCE(@SequenceGenerator)

 - database의 sequence기능을 사용 

 - oracle -> sequence

 - mariadb -> 10.3 부터 sequence 지원

 

#TABLE (@TableGenerator)

 - 키 전용 Table별도생성

 

반응형
블로그 이미지

visualp

c#, java

,
반응형
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">

위 처럼 html 을 선언하거나 layout을 사용했다면 아래와 같이 선언 합니다.

<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{thymeleaf/layout/default}" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">

 

hasRole('ROLE_ADMIN') 해당 권한이 있을 경우
hasAnyRole('ROLE_ADMIN,'ROLE_USER') 포함된 권한 중 하나라도 있을 경우
isAuthenticated() 권한에 관계없이 로그인 인증을 받은 경우
isFullyAuthenticated() 권한에 관계없이 인증에 성공했고, 자동 로그인이 비활성인 경우
isAnonymous() 권한이 없는 익명의 사용자일 경우
isRememberMe() 자동 로그인을 사용하는 경우
permitAll 모든 경우 출력함
denyAll 모든 경우 출력하지 않음

 

ex) ROLE_ADMIN 권한을 가진 사용자에게만 보여준다면 아래와 같이 사용 할 수 있습니다.

<div class="card-body" sec:authorize="hasRole('ROLE_ADMIN')" ></div>

 

반응형
블로그 이미지

visualp

c#, java

,

thymeleaf , enum switch case

Java 2021. 5. 27. 00:15
반응형
 <td th:switch="${#strings.toString(item.rdStatus)}" >
   <span th:case="대기"  th:text="${item.rdStatus}" class="badge badge-outline-primary"  />
   <span th:case="할당"  th:text="${item.rdStatus}" class="badge badge-outline-primary"  />
   <span th:case="진행"  th:text="${item.rdStatus}" class="badge badge-outline-primary"  />
   <span th:case="완료"  th:text="${item.rdStatus}" class="badge badge-outline-primary"  />
   <span th:case="취소"  th:text="${item.rdStatus}" class="badge badge-outline-primary"  />
 </td>

 

switch 문에서 ${#strings.toString(item.rdStatus)} 와 같이 enum 값을 -> toString 처리 object->string변환

을 통해서 switch, case문 정상 동작 됩니다.

 

반응형
블로그 이미지

visualp

c#, java

,
반응형
ClassLoader classLoader = getClass().getClassLoader();
try (InputStream inputStream  = classLoader.getResourceAsStream(filePath))
{
	InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
}catch(Exception e){
	e.printStackTrace();
}

 

 

반응형
블로그 이미지

visualp

c#, java

,