2

I'm working on a Java Web-related project. At this moment, I try to combine some frameworks all together (Hibernate ORM, Apache Shiro). Of course, in the nearest future, I might need some add-ons via maven dependencies. Is it possible to pack it all together, thus for an emergency case also to pack maven? Due to policy restrictions, there is no chance to install the necessary development tools to make it work.

Is it possible to import maven into WEB - project as JAR?

Malakai
  • 3,011
  • 9
  • 35
  • 49

1 Answers1

1

It seems like you want to just keep your entire project directory if I'm understanding you correctly.

Are you sure that they cannot install Maven? If so then you'd want to package maven with the project.

Could you give me more details about the environment you'd be using?

You could easily import the jar into the maven web project. Under the modules section the web projects pom.xml just specify the directory if it is in the same project. If not, you'll have to add it as a dependency. You'll need the group and artifact ID of the jar you want to add. You can find some pointers here.

An example for the project directory structure:

  <modules>
    <module>the web part</module>
    <module>the backed part</module>
  </modules>

Each different module would be a sub module of a master project.

This should help you with setting up the classpath. Also take a look @ this:

http://stackoverflow.com/questions/364114/can-i-add-jars-to-maven-2-build-classpath-without-installing-them
Zeratas
  • 1,005
  • 3
  • 17
  • 36
  • "Are you sure that they cannot install Maven?" Yes, I'm sure. "Could you give me more details about the environment you'd be using?" It's university computer Java 1.8 (some of them uses JRE 1.6, 1,7) but what i know best - one of mine frameworks require java 1.8 – Malakai Nov 10 '14 at 21:13
  • As far as i understood (if i have many jar @ one directory and i need to add all of them) it should be like this: `code` FRAMEWORK_LIB */ `code` – Malakai Nov 10 '14 at 21:16
  • You should be adding all of your frameworks through the dependency sections in the pom.xml (check the link). The only ones that would be in the modules section would be local code changes. You may be able to just ship a copy of maven with the project but that is very dependent on what settings the SysAdmin has on the university computers. – Zeratas Nov 10 '14 at 21:18
  • "You should be adding all of your frameworks through the dependency sections in the pom.xml" Yeah, i know it :D i have small experience. Unfortunately , they can't install it for the following reasons: 1) It's not actual at this moment (i'm only the one who make web related project) 2)Hardware isn't too good for that(low disk storage + about 512 Mb ram.... + Core 2 Duo ... so ... *cough* it may takes to much time) – Malakai Nov 10 '14 at 21:26
  • Ahhh gotcha! Then you'll want to make sure they are added to your classpath for the project. You should create a lib folder to contain it. I added some more links to help you on your way in my answer. – Zeratas Nov 10 '14 at 21:39
  • 1
    Please select this as an answer if it helped you! – Zeratas Mar 10 '15 at 15:34
  • 1
    Hello. I found annother solution for that (easier to me than yours ;) ) - I've created Dynamic Web Application(Eclipse), then created 'lib' folder where i dropped jars from maven repo. After that, i added this to build path. And finally - i converted whole project to Maven. It might be stupid what i've done but it worked for me – Malakai Mar 12 '15 at 20:33