Java Maven Project appears in another project as directory not a jar -


so, created spring maven project, dao project, works great. code in correct place, unit tests run, , can mvn clean install. can see in target directory there build jar, , in looks fine. can confirm when check local .m2/repository, latest jar built in there.

here small segment of pom.xml:

<modelversion>4.0.0</modelversion> <groupid>com.tom.myproject</groupid> <artifactid>myproject-dao</artifactid> <version>0.0.1-snapshot</version> <packaging>jar</packaging> <name>my project dao</name> 

now, creating new spring maven web-project ui, , pom.xml starts out like:

<modelversion>4.0.0</modelversion> <version>0.0.1-snapshot</version> <groupid>com.tom.myproject</groupid> <artifactid>myproject-ws</artifactid> <name>my web project</name> <packaging>war</packaging> 

also in pom.xml file, 1 of first dependencies have is:

    <!-- dao projectdependencies -->     <dependency>         <groupid>com.tom.myproject</groupid>         <artifactid>myproject-dao</artifactid>         <version>0.0.1-snapshot</version>         <type>jar</type>         <scope>compile</scope>     </dependency> 

i can see in eclipse when try access classes dao jar, seems work fine. when compile code here, works fine. , when "mvn clean install" build war, can see target directory, , needed classes , jars come in, there hibernate, logging, , spring classes there in web-inf/lib directory.

now part question comes in ... why myproject-dao show under web-inf/lib web-inf/lib/myproject-dao-0.0.1-snapshot.jar appears directory, , not jar?

certainly when pull in other jars, .jar files , not directories.

i should add, when in eclipse project under maven dependencies, icon other jars show them files. icon myproject-dao.jar uses icon folder/directory, directory named "myproject-dao.jar" being created , not file zipped contents jar file.

when build war file, , deploy war, app says cannot find of classes in myproject-dao.jar directory. have delete folder "myproject-dao.jar" web-inf/lib directory , manually copy on file "myproject-dao.jar". can see icon means file.

this simple fix, if can me out, great.

answer:

i wasn't using maven-assembly-plugin. but, did find out problem is.

both dao project , web project in same workspace, , dao project open, result, maven dependency shown in eclipse folder icon, , not jar icon. when closed dao project , looked @ maven dependencies on web project pom.xml file ... shows icon jar , not folder.

so, have build dao.jar file maven, , when successful, done. have close project within eclipse. in web project pom.xml file, icon show jar file, , when builds, pull in jars.

i imagine benefit if 1 working on several prior project, have chance @ in jar file while war running.

in case, know dao.jar working, can build it, , close project, , make use of jar anywhere need it.

i wasn't using maven-assembly-plugin. but, did find out problem is.

both dao project , web project in same workspace, , dao project open, result, maven dependency shown in eclipse folder icon, , not jar icon. when closed dao project , looked @ maven dependencies on web project pom.xml file ... shows icon jar , not folder.

so, have build dao.jar file maven, , when successful, done. have close project within eclipse. in web project pom.xml file, icon show jar file, , when builds, pull in jars.

i imagine benefit if 1 working on several prior project, have chance @ in jar file while war running.

in case, know dao.jar working, can build it, , close project, , make use of jar anywhere need it.

thanks help!


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -