korosh afshar wrote:

can someone tell me why I get this error when I  try to run the template
project ?

Details in line.



I run the merlin command as such:

<PROJECT DIRECTORY>/template/impl$ merlin -execute target/classes

You problem appears to be that you are using "merlin" instead of "merlinx". The "merlin" command defaults to the avalon repository whereas merlinx defaults to the maven repository.


Try the following:

$ merlinx -execute target/classes


and I get:

But there are a few things in the trace that's don;t make sense.


More inline ....

---- exception report
----------------------------------------------------------
Exception: org.apache.avalon.merlin.KernelException
Message: Install failure:
file:/opt/projects/ps/template/impl/target/template-impl-1.0.jar


This does not make a lot of sense relative to the command line. You command line is setting the deployment target to the target/classes directory. As such template-impl-1.0.jar is being referenced. I'm going to assume that the stack trace was a result of running something like:

$ merlin -execute target/classes/template-impl-1.0.jar


---- cause
---------------------------------------------------------------------
Exception: org.apache.avalon.composition.model.ModelException
Message: Unable to create block from embedded descriptor
[jar:file:/opt/projects/ps/template/impl/target/template-impl-1.0.jar!/BLOCK-INF/block.xml]
 in the containmment model [/] due to a build related error.

So merlin is reading in this jar file and looking for the deployment descriptor under the default location BLOCK-INF/block.xml but it is having a problem.


---- cause
---------------------------------------------------------------------
Exception: org.apache.avalon.composition.model.ModelException
Message: Could not create classloader.

Ok, so Merlin could not create a classloader relative to the classloader declared in the block.xml file.



---- cause
---------------------------------------------------------------------
Exception: org.apache.avalon.repository.RepositoryException
Message: Failed to download artifact to local cache file
/home/korosh/.avalon/repository/template/jars/template-api-1.0.jar from
hosts:
  http://dpml.net/
  http://www.ibiblio.org/maven/

And the reason is that Merlin could not find the template-api-1.0.jar in you local repository. As mentioned above, using merlinx is a useful way of running merlin relative to the maven repository. But also keep in mind that when you have problems like this, switch in -info to see what assumptions merlin is making about repositories, caches, etc.


E.g. merlin -info ...


---- cause
---------------------------------------------------------------------
Exception: java.io.IOException
Message: Connection returned a null input stream:
http://www.ibiblio.org/maven/template/jars/template-api-1.0.jar

This exception message could be improved - what it means is that the /template-api-1.0.jar at the address supplied does not exist. What we should do is to improve the exception reporting to throw something like a file not found exception referencing the local cache and the fallback hosts.


why does merlin try to download the template api  jar into my local
cache from ibiblio ?

Only if the resource is not found in you cache. And in your example you cache is at ${avalon.home}/repository/... but the resource only exist in the maven repository.


I guess I am a bit fuzzy on how the repository works with merlin. I have
looked at maven documentation and realize how its main repository
mechanism works.


Merlin maintains a separate repository form Maven mainly because of conflicts that arrive when development objectives and deployment objectives conflict. But you can manage this by either using merlinx, or using the -repository parameter to declare that the default repository to use is the maven repo.

Hope that clears things up.

Cheers, Steve.

--
|------------------------------------------------|
| Magic by Merlin                                |
| Production by Avalon                           |
|                                                |
| http://avalon.apache.org/merlin                |
| http://dpml.net/                               |
|------------------------------------------------|

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to