Preloader image
DDD

자바

@Junit .. error: package org.junit does not exist

작성자 관리자 (admin)
조회수 1,941
입력일 2021-05-31 12:10:23

 

Run As > Maven Build

---------------------------------------------------------------------------------------------------------------------------------- start ----------------------------

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.erp:auto_process:war:1.0.0-BUILD-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.googlecode.json-simple:json-simple:jar -> version 1.1.1 vs 1.1 @ line 423, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-war-plugin is missing. @ line 489, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] ------------------------< com.erp:auto_process >------------------------
[INFO] Building SP4318 Digital2U 1.0.0-BUILD-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ auto_process ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 20 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ auto_process ---
[INFO] Compiling 117 source files to C:\_PROJECT\workspace\Digital2uCommunity\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] bad path element "C:\_PROJECT\maven_repo\org\apache\xmlgraphics\batik-squiggle-ext\1.9.1\rhino-1.7.7.jar": no such file or directory
C:\_PROJECT\workspace\Digital2uCommunity\src\main\java\com\erp\common\function\TextDownload.java:[8,16] error: package org.junit does not exist
[ERROR] C:\_PROJECT\workspace\Digital2uCommunity\src\main\java\com\erp\common\function\XMLread.java:[11,16] error: package org.junit does not exist
[ERROR] C:\_PROJECT\workspace\Digital2uCommunity\src\main\java\com\erp\common\JasyptUtil.java:[4,0] error: package org.junit does not exist

[ERROR] C:\_PROJECT\workspace\Digital2uCommunity\src\main\java\com\erp\common\function\XMLread.java:[26,2] error: cannot find symbol
[ERROR]   symbol:   class Test
  location: class XMLread
C:\_PROJECT\workspace\Digital2uCommunity\src\main\java\com\erp\common\JasyptUtil.java:[13,2] error: cannot find symbol
[INFO] 5 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.692 s
[INFO] Finished at: 2021-05-31T12:22:44+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project auto_process: Compilation failure: Compilation failure: 
[ERROR] bad path element "C:\_PROJECT\maven_repo\org\apache\xmlgraphics\batik-squiggle-ext\1.9.1\rhino-1.7.7.jar": no such file or directory
[ERROR] C:\_PROJECT\workspace\Digital2uCommunity\src\main\java\com\erp\common\function\TextDownload.java:[8,16] error: package org.junit does not exist
[ERROR] C:\_PROJECT\workspace\Digital2uCommunity\src\main\java\com\erp\common\function\XMLread.java:[11,16] error: package org.junit does not exist
[ERROR] C:\_PROJECT\workspace\Digital2uCommunity\src\main\java\com\erp\common\JasyptUtil.java:[4,0] error: package org.junit does not exist

[ERROR] C:\_PROJECT\workspace\Digital2uCommunity\src\main\java\com\erp\common\function\XMLread.java:[26,2] error: cannot find symbol
[ERROR]   symbol:   class Test
[ERROR]   location: class XMLread
[ERROR] C:\_PROJECT\workspace\Digital2uCommunity\src\main\java\com\erp\common\JasyptUtil.java:[13,2] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/MojoFailureException

---------------------------------------------------------------------------------------------------------------------------------- end ----------------------------

import org.junit.Test;

...

@Test
public void get_xml_file() throws Exception
{
...

}

으로 인한 Build 에러입니다.

Solution 1) pom.xml > junit > scope 주석처리

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <!-- <scope>test</scope>  -->
        </dependency>

Solution 2) 해당 Java 파일에서 @Test 를 제거

^