NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

How to add a .jar to a maven project in netbeans?

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
ricalc



Joined: 05 Feb 2010
Posts: 3

PostPosted: Fri Feb 05, 2010 5:44 pm    Post subject: How to add a .jar to a maven project in netbeans? Reply with quote

How to add a .jar to a maven project in netbeans 6.8?

I cannot find any way to do it.
I want to add this lib:
google-api-translate-java-0.82.jar

thanks in advance
Back to top
russpet



Joined: 13 Jan 2010
Posts: 19

PostPosted: Sat Feb 06, 2010 4:02 pm    Post subject: Reply with quote

I'm not sure if netbeans has a way to do this from the NB gui. I struggled with this too. I ran "mvn install... <more args>" from the command line.

http://today.java.net/pub/a/today/2007/03/01/building-web-applications-with-maven-2.html

I believe I had to either recompile at the top project or stop/start netbeans to then recognize a jar had been added to the local repository manually.
Back to top
Dafe Simonek
Posted via mailing list.





PostPosted: Mon Feb 08, 2010 3:21 pm    Post subject: How to add a .jar to a maven project in netbeans? Reply with quote

Well there is a way from NB gui I believe, try this:

1) In Maven project open "Add dependency" dialog
2) Make up some groupId, artifactId and version and fill them, OK.
3) Dependency will be added to the pom.xml and will appear under
"Libraries" node of maven project
4) Right-click Lib node and "manually install artifact", fill the path
to the jar
Jar should be installed to local Maven repo with coordinates entered in
step 2)

Dafe

russpet wrote:
Quote:
I'm not sure if netbeans has a way to do this from the NB gui. I struggled with this too. I ran "mvn install... <more args>" from the command line.

http://today.java.net/pub/a/today/2007/03/01/building-web-applications-with-maven-2.html

I believe I had to either recompile at the top project or stop/start netbeans to then recognize a jar had been added to the local repository manually.




Back to top
jdictionary



Joined: 02 Mar 2012
Posts: 1
Location: Atlanta

PostPosted: Fri Mar 02, 2012 5:04 pm    Post subject: Re: How to add a .jar to a maven project in netbeans? Reply with quote

Thanks Dafe, exactly what I was looking for. Works great. Just to add to your instructions, to get to the "Add dependency" dialog, right-click on the "Dependencies" folder in the Projects view. It is the first option (I am using Netbeans 7.1.1). Also, note that when you execute these steps, Netbeans will issue the following mvn command behind the scenes:

mvn -DartifactId={artifact id} -DgroupId={group id} -Dversion={version} -Dpackaging=jar -Dfile={path to jar} -DgeneratePom=false install:install- file

Dafe Simonek wrote:

1) In Maven project open "Add dependency" dialog
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo