문제

I have an EJB/Web project that I have created with netbeans. I have created the project with netbeans so we would have a working prototype quickly. Now I'm converting this to Gradle. I'm using the ear plugin and my structur

-root
|-- ejb.jar
|-- web.war

is building. My dependencies are defined in the build.gradle file in each sub project (ejb and web). Now I want my dependencies to be in the ear/lib folder instead of being shatterd over the ejb/lib and web/lib folder. I know the concept of earlib dependencies, but I feel I do not need to specify this in my web and ejb project. Do I need to write an ant task to get this done or is there an elegant way. I'm trying to represent the netbeans build war as good as possible.

도움이 되었습니까?

해결책

The proper solution is to manage the scope of your dependencies.

In the jar project, the dependencies are place in compile scope, this is ok, because a jar does not add the dependencies when packaging

In the war project, the dependencies are placed in providedCompile scope. This allows me to compile my war, but not to package my libaries.

In my root of my project I have my ear build file. In this build file I have re-added all the dependencies (this still feels wrong because I have defined my dependencies twice) with the earLib scope. By doing so, my dependencies are place in root of my project in my defined lib folder.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top