Rather than putting the parent in the repo, try using maven to install it.
Ron
On 29/11/2013 8:17 AM, Malte Skoruppa wrote:
Hey guys,
I want to build a project that I downloaded
(https://sourcecode.valg.no/websvn/listing.php?repname=Internettstemmegivning)
and that is supposed to work fine.
Yet I cannot build even the first module, because Maven tells me it
cannot find the parent POM. The parent POM is there in the local repo,
at the correct location, yet somehow Maven refuses to see it and tries
to fetch it remotely, which clearly will not work. This parent POM is
a general POM of packaging type "pom" that defines some plugin
versions to be used etc.
Put simply:
* I extracted the m2repository.tar (from the above URL) to
/home/malte/.repository
* I extracted the module "cryptography-2.0.0" from code.tar (from the
above URL) to /home/malte/cryptography-2.0.0
Now, in /home/malte/cryptography-2.0.0/pom.xml there is the section:
<parent>
<groupId>com.scytl</groupId>
<artifactId>maven-generic-conf</artifactId>
<version>1.1.39</version>
</parent>
The corresponding parent POM *does exist* in the local repo:
$ ls
~/.repository/com/scytl/maven-generic-conf/1.1.39/maven-generic-conf-1.1.39.pom
/home/malte/.repository/com/scytl/maven-generic-conf/1.1.39/maven-generic-conf-1.1.39.pom
$
Yet when I try to validate the module cryptography-2.0.0:
[~/cryptography-2.0.0] $ mvn validate -X -U
-Dmaven.repo.local=/home/malte/.repository
Apache Maven 3.0.4
...snip...
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /home/malte/.m2/settings.xml
[DEBUG] Using local repository at /home/malte/.repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10
for /home/malte/.repository
[INFO] Scanning for projects...
[DEBUG] Verifying availability of
/home/malte/.repository/com/scytl/maven-generic-conf/1.1.39/maven-generic-conf-1.1.39.pom
from [central (http://repo.maven.apache.org/maven2, releases)]
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for
http://repo.maven.apache.org/maven2
Downloading:
http://repo.maven.apache.org/maven2/com/scytl/maven-generic-conf/1.1.39/maven-generic-conf-1.1.39.pom
[DEBUG] Writing resolution tracking file
/home/malte/.repository/com/scytl/maven-generic-conf/1.1.39/maven-generic-conf-1.1.39.pom.lastUpdated
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were
encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Could not find artifact
com.scytl:maven-generic-conf:pom:1.1.39 in central
(http://repo.maven.apache.org/maven2) and 'parent.relativePath' points
at wrong local POM @ line 3, column 13
at
org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:363)
...snip...
[ERROR] The project com.scytl.jbasis:cryptography:2.0.0
(/home/malte/cryptography-2.0.0/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not find artifact
com.scytl:maven-generic-conf:pom:1.1.39 in central
(http://repo.maven.apache.org/maven2) and 'parent.relativePath' points
at wrong local POM @ line 3, column 13 -> [Help 2]
org.apache.maven.model.resolution.UnresolvableModelException: Could
not find artifact com.scytl:maven-generic-conf:pom:1.1.39 in central
(http://repo.maven.apache.org/maven2)
...snip...
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException:
Could not find artifact com.scytl:maven-generic-conf:pom:1.1.39 in
central (http://repo.maven.apache.org/maven2)
...snip...
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2]
http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
As you can see Maven tries to fetch
com.scytl:maven-generic-conf:pom:1.1.39 from central, which clearly
does not work.
What bugs me in particular is this line:
[DEBUG] Verifying availability of
/home/malte/.repository/com/scytl/maven-generic-conf/1.1.39/maven-generic-conf-1.1.39.pom
from [central (http://repo.maven.apache.org/maven2, releases)]
Why? WHY? I mean, the file
/home/malte/.repository/com/scytl/maven-generic-conf/1.1.39/maven-generic-conf-1.1.39.pom
is THERE. It's fine. Why does Maven want to download it from central
repo? Why won't it just read it?
Also, if I actually put maven-generic-conf-1.1.39.pom in the parent
directory and rename it to pom.xml, the build works fine:
[~] $ mkdir maven-generic-conf
[~] $ cp
~/.repository/com/scytl/maven-generic-conf/1.1.39/maven-generic-conf-1.1.39.pom
maven-generic-conf/pom.xml
[~] $ cp -r cryptography-2.0.0/ maven-generic-conf/
[~] $ cd maven-generic-conf/cryptography-2.0.0/
[~/maven-generic-conf/cryptography-2.0.0] $ mvn validate -X -U
-Dmaven.repo.local=/home/malte/.repository
...snip...
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 3.173s
[INFO] Finished at: Fri Nov 29 13:46:21 CET 2013
[INFO] Final Memory: 9M/211M
[INFO]
------------------------------------------------------------------------
While this is a workaround, it is not a solution. The project is quite
large and complex, and I cannot just rebuild the entire project
structure. (There are more very similar problems.) Also, different
version of maven-generic-conf are used by different modules, etc.
Yes, I did visit both URLs at [Help 1] and [Help 2], and read them
carefully. It is true that a <relativePath> is not set in the child
module (i.e., cryptography-2.0.0), but in an entirely different
project of mine the <relativePath> is not set either and its parent
POM is also only in the local repo, yet that one validates fine. Also
as can be seen from the [DEBUG] line stated above, Maven does know the
correct location of the parent POM, apparently it just doesn't read it.
I googled for similar problems. But I could not find a solution.
I also tried to use the -o switch to make the build offline and force
Maven to not download anything. But the error I get then is quite
similar:
[FATAL] Non-resolvable parent POM: The repository system is offline
but the artifact com.scytl:maven-generic-conf:pom:1.1.39 is not
available in the local repository. and 'parent.relativePath' points at
wrong local POM @ line 3, column 13
Does anyone have an idea of what may be going on here? Any help would
be GREATLY appreciated. I'm out of ideas here. It may be something
very simple, and I just miss experience with Maven :)
Many thanks,
Malte
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
Ron Wheeler
President
Artifact Software Inc
email: [email protected]
skype: ronaldmwheeler
phone: 866-970-2435, ext 102
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]