简体   繁体   中英

how not to generate maven jar

This is my project structure

parent project - pom.xml
|
|----------> simple-math -- pom.xml
|----------> simple-web -- pom.xml

simple-math gives a function called App.add(a,b) which adds two numbers.

simple-web used this App.add and displays it in index.jsp

Its working beautifully with default settings that is with jar and war.

What i would like to do is not let simple-math produce jar, instead make them produce plain old class files. and simple-web calls Add with .class path than jar

What changes should i make in pom.xml -- simple-math how should I execute this from parent project?

The philosophy of Maven is to produce just one main artefact for a project. A project typically contains more than one class so packaging them up into a jar makes sense.

Another reason for doing that is that an artifact you deploy into a repository gets the version number into its name. You could not do that with a class file.

If you really want to have the individual class files in your war you can try to expand the simple-math-{version}.jar during the build of the simple-web project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM