To start, I do not know much about maven or even jar's in general...
So basically I have been given a jar that was not created with maven to use in my maven project
Inside it has in it some classes:
com/something/types/Foo.class
com/something/types/Bar.class
com/something/utils/Foou.class
com/something/utils/Baru.class
etc.
I have tried running the following:
mvn install:install-file -Dfile=something.jar -DgroupId=com.something.somethingelse \
-DartifactId=somethingelse -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true
and it says build success and has created the following:
~/.m2/repository/com/something/somethingelse/somethingelse/1.0/somethingelse-1.0.jar
~/.m2/repository/com/something/somethingelse/somethingelse/1.0/somethingelse-1.0.pom
in my project's pom I have included the following:
<dependency>
<groupId>com.something.somethingelse</groupId>
<artifactId>somethingelse</artifactId>
<version>1.0</version>
</dependency>
In my project I import like so:
import com.something.types.Foo
import com.something.utils.Foou
etc.
But when I run mvn install
on my project I receive errors like the following every time I try to use something from the jar?
[ERROR] {{ProjectClass.java}}[line,col] cannot find symbol
[ERROR] symbol: class Foo
[ERROR] location: class ProjectClass
Please help! I do not use eclipse.
This process worked fine. The errors ended up being mistakes in my java code. For example:
import com.something.types.Foou // my old code
import com.something.utils.Foou // working import
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.