karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Jencks (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-565) junit bundle missing (required by dev commands)
Date Mon, 18 Apr 2011 22:59:05 GMT

    [ https://issues.apache.org/jira/browse/KARAF-565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13021328#comment-13021328
] 

David Jencks commented on KARAF-565:
------------------------------------

I think all the problematic code is in BundleWatcher:

    public File getBundleExternalLocation(File localRepository, Bundle bundle) {
        try {
            Parser p = new Parser(bundle.getLocation().substring(4));
            return new File(localRepository.getPath() + File.separator + p.getArtifactPath());
        } catch (MalformedURLException e) {
            logger.error("Could not parse artifact path for bundle" + bundle.getSymbolicName(),
e);
        }
        return null;
    }

    public File getLocalRepository() {
        // Attempt to retrieve local repository location from MavenConfiguration
        MavenConfiguration configuration = retrieveMavenConfiguration();
        if (configuration != null) {
            MavenRepositoryURL localRepositoryURL = configuration.getLocalRepository();
            if (localRepositoryURL != null) {
                return localRepositoryURL.getFile().getAbsoluteFile();
            }
        }
        // If local repository not found assume default.
        String localRepo = System.getProperty("user.home") + File.separator + ".m2" + File.separator
+ "repository";
        return new File(localRepo).getAbsoluteFile();
    }

    protected MavenConfiguration retrieveMavenConfiguration() {
        MavenConfiguration mavenConfiguration = null;
        try {
            Configuration configuration = configurationAdmin.getConfiguration(ServiceConstants.PID);
            if (configuration != null) {
                Dictionary dictonary = configuration.getProperties();
                if (dictonary != null) {
                    DictionaryPropertyResolver resolver = new DictionaryPropertyResolver(dictonary);
                    mavenConfiguration = new MavenConfigurationImpl(resolver, ServiceConstants.PID);
                }
            }
        } catch (IOException e) {
            logger.error("Error retrieving maven configuration",e);
        }
        return mavenConfiguration;
    }


However I now wonder if a different approach is possible.  Instead of trying to locate the
local maven repo and compute the path to the file to watch ourselves, thus exposing internals
we don't really care about, can't we use aether to resolve the mvn location url and get the
local file out of the aether artifact result?  This would eliminate the need to expose more
from pax-url-aether.

> junit bundle missing (required by dev commands)
> -----------------------------------------------
>
>                 Key: KARAF-565
>                 URL: https://issues.apache.org/jira/browse/KARAF-565
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 3.0.0
>            Reporter: Jean-Baptiste Onofré
>             Fix For: 3.0.0
>
>
> Currently, with a fresh build on trunk, when starting Karaf, we got:
> It means that the JUnit bundle is not installed and started at boot time, which prevent
dev commands usage.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message