Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
485 views
in Technique[技术] by (71.8m points)

dependencies - How to tell M2Eclipse to install jar file as a maven dependency

I want to add jpoller.jar as a maven dependency, so I edited my pom.xml file to include it:

<dependency>
    <groupId>org.sadun</groupId>
    <artifactId>jpoller</artifactId>
    <version>1.5.2</version>
</dependency>

Now, as expected, when I compile from the command line I get an error because jpoller isn't in any of the repositories I have listed in my pom, nor could I find one for it. Although I could create a repository for it, I'd rather not at this point. Thus, I get the following error:

[INFO] Failed to resolve artifact.

Missing: ---------- 1) org.sadun:jpoller:jar:1.5.2

Try downloading the file manually from the project website.

Then, install it using the command: mvn install:install-file -DgroupId=org.sadun -DartifactId=jpoller -Dversion=1.5.2 -Dpackaging=jar -Dfile=/path/to/file

How can I do this from the M2Eclipse plugin on machines where the maven CLI isn't available?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

How can I do this from the M2Eclipse plugin on machines where the maven CLI isn't available?

Well, simply do it from Eclipse. First, get that jpoller jar and save it somewhere on your file system. Then, in Eclipse, from the top bar, Run > Run Configurations... then right-click on Maven Build and configure the New_configuration freshly created:

  • Select an arbitrary Base directory
  • Fill the Goals with install:install-file
  • Add parameters for each required parameters, without the -D prefix (e.g. file as Parameter name and /path/to/file as Value and so on for groupId, artifactId,packaging and version).

And run this configuration. Or... just install Maven.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...