Maven - 메이븐

미니멀리즘·2022년 12월 30일
0

메이븐이란
프로젝트 매니지먼트 툴(매니지먼트 디펜던시빌드 가장많이 사용)

solution
jar파일을을 따로 붙이지 않고, xml에 이러이러한 식으로 설정할 것이다라고 선언해 놓으면, 직접 알아서 준비를 해 놓음

https://repo.maven.apache.org/maven2/

Maven 이란 
- Maven is a Project Management tool
- Most popular use of Maven is for build management and dependencies


Maven 사용 전의 상황 
- When building your Java project, you may need additional JAR files
- For example: Spring, Hibernate, Commons Logging, JSON etc…
- One approach is to download the JAR files from each project web site
- Manually add the JAR files to your build path / classpath


Maven solution  
- Tell Maven the projects you are working with (dependencies)
   Spring, Hibernate etc ….
- Maven will go out and download the JAR files for those projects for you
- And Maven will make those JAR files available during compile/run
- Think of Maven as your friendly helper / personal shopper

메이븐 설치 되어있나 확인하기

설치되어있지 않다면 Install Maven m2eclipse Plugin 설치하기

Help - install new Software

already install

Java EE로 변경하기

메이븐 프로젝트(quickstart) 생성하기

next - quickstart 검색 (느림 기다려야함)

인터넷에서 필요한 부분 다운로드 하는중

Console창 확인 - Y

의도되로 설치 되었나 확인하기

JavaSE - 1.7

<!--주어진 자바 버전에서 클래스파일을 생성하는데 쓰이는 부분주어진 자바 버전에서 클래스파일을 생성하는데 쓰이는 부분-->
<maven.compiler.source>1.7</maven.compiler.source>
<!--사용된 소스코드의 자바버전-->
<maven.compiler.target>1.7</maven.compiler.target>

설정에 변경이 있을경우 수정하기

메이븐 프로젝트(apache.maven) 추가하기

next - apache.maven 검색 (느림 기다려야함)

Finish

에러메세지 확인하기

메이븐 공식 배포 싸이트 접속
https://search.maven.org/
https://central.sonatype.dev/

javax.servlet-api 검색하기

3.1.0 맞는버전 착아 검색하기

복사 // porm.xml에 붙여넣기

웹서버에 잘 표시되는지 확인하기

하이버 네이트 dependency 붙여넣기

https://mvnrepository.com/artifact/org.hibernate/hibernate-core/5.2.11.Final

Update project 하지 않아도잘 붙여짐

직접만든 파일 붙여넣기

startfile 추가하기 다운로드

File - import- maven - Existing maven Projects

결과 확인

war파일 플러그인이 존재 하지 않음

https://central.sonatype.dev/artifact/org.apache.maven.plugins/maven-war-plugin/3.2.0 에서 검색해오기

태그 직접 설정해서 붙여넣기

	<!-- TO DO: Add support for Maven WAR Plugin -->
	<build>
		<finalName>spring-security-demo</finalName>
		<pluginManagement>
			<plugins>
				<plugin>
				    <groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-war-plugin</artifactId>
					<version>3.2.0</version>
				</plugin>
			</plugins>
		</pluginManagement>		
	</build>
profile
웹 개발자

0개의 댓글