java - Maven stand alone jars with shared code dependencies -
i'm ramping on maven perhaps rookie questions. i've found various pieces puzzle yet find clear doc on how achieve following.
i have common java code want share between 2 java applications. i've set using maven modules follows:
root dir pom.xml shared_code pom.xml src ... app1 pom.xml src ... app2 pom.xml src ...
the pom.xml
file in dir simple , consists of
<packaging>pom</packaging> <modules> <module>shared_code</module> <module>app1</module> <module>app2</module> </modules>
the pom.xml
in shared_code
subfolder uses maven-compiler-plugin
, <packaging>jar</packaging>
create jar file.
the pom.xml
s in app
subfolders use
maven-compiler-plugin maven-jar-plugin maven-dependency-plugin
and mark shared_code
module dependency.
this works okay, i'm failing achieve goals. firstly, resources mess. can't resources shared_code automagically available app
s. secondly, creates me jar
file each app
contains classes app
. in subfolder (in generated target
folder) dependency jars, including shared_code
one.
could explain how achieve following please
- resources
shared_code
automagically deployed , made availableapp
s. bonus points, canapps
override resources somehow? - how create single jar file rather jar subfolder full of dependencies?
- how create executable rather jar?
for other bonus points, please feel free tell me i'm approaching problem in non-canonical way , correct me.
- for shared resources use maven remote resources plugin
- for creating jar containing other dependencies & being executable need create called fat jar
this should give hint on how achieve goals. explain in answer explode topic think.
maybe can ask followup question regarding 2 topics separate if need further besides hints gave.
Comments
Post a Comment