aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Using Maven Module with a Module that is not Maven - Possible? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Using Maven Module with a Module that is not Maven - Possible?" Watch "Using Maven Module with a Module that is not Maven - Possible?" New topic
Author

Using Maven Module with a Module that is not Maven - Possible?

Jeremy McNally
Ranch Hand

Joined: Feb 21, 2014
Posts: 92
Can I use a module made without Maven and use it with a module using Maven? I just want to know if this is possible and if so how? Thank you everyone so much.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9351
    
    2

Are you talking about using a module as a dependency to one of your existing Maven project?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Jeremy McNally
Ranch Hand

Joined: Feb 21, 2014
Posts: 92
Yes. The project is dependent on the task I just did. It is a Maven project but the task I worked on at the time I was not able to use Maven.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

If you built a module without using Maven, but you want to use it as a dependency in a Maven project, all that you need to do is import the module into your Maven repository. That causes the module to be archived under whatever artefact name you want to give it. After that, the dependent project references the module just like it was a Maven-build module constructed and archived via the "mvn install" command.

We have an Ant/Maven forum where you can get answers from the experts. I'm moving this thread there.


Customer surveys are for companies who didn't pay proper attention to begin with.
Jeremy McNally
Ranch Hand

Joined: Feb 21, 2014
Posts: 92
Thank you for your response Tim. I will give it a shot at work and let you know what happens.
I have one question though.
Would I need to do something exactly like below?:

.openshift/action_hooks/pre_build:
mvn install:install-file
-Dfile=../../app-root/rep/JARFILENAME.jar
-DgroupId=packageName
-DartifactId=projectName
-Dversion=1.0
-Dpackaing=jar

The (groupID/artifactId/version) would be the only things to match the corresponding dependency in my pom.xml from what I am aware from my research.

Also once I do that if I still need to do it per your advice I would still place the dependency in the pom.xml?

<dependency>
<groupId>packageName</groupId>
<artifactId>projName</artifactId>
<version>1.0</version>
</dependency>


Or would I just import the module not created using Maven into my Maven Repository and I am good from there. If I am not good from there and what I did above isn't necassary, could you lay out the commands for me that you are talking about as I would need to have them once I import it to the Maven Repo?

Thanks Tim.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Yes, you still have to include the dependency in your maven project's POM. That's how a given maven project knows that it needs that module.

Use the exact same projectId, artifactId and version ID in your POM as you did when you installed the module to your Maven repository. They're the "database keys", if you like that help Maven's dependency mechanism find the module in the repository.
Jeremy McNally
Ranch Hand

Joined: Feb 21, 2014
Posts: 92
Good to know thank you Tim. That is all I need but I per another task at work I will be coming back to this later this week. Once I do it, I will post what happened on this thread and mark it resolved if that is the case at that time. Thanks for your help Tim and have a good day.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Using Maven Module with a Module that is not Maven - Possible?