Show
Ignore:
Timestamp:
09/01/10 16:16:44 (21 months ago)
Author:
seelmann
Message:

Deterministic guess of fallback docroot, refactored some code to LiveUtils?

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-0.15.x/pustefix-live/src/main/java/org/pustefixframework/live/LiveResolver.java

    r5331 r5334  
    6464            throw new IllegalArgumentException(path); 
    6565        } 
    66          
     66 
    6767        if (file.exists()) { 
    6868            url = file.toURI().toURL(); 
     
    9393            LOG.debug("Resolving live module root from live.xml for " + url + ":" + path); 
    9494        } 
    95          
     95 
    9696        if (path.startsWith("/")) { 
    9797            path = path.substring(1); 
     
    185185    } 
    186186 
    187     private static File guessFallbackDocroot(String srcMainWebapp) { 
     187    private static File guessFallbackDocroot(String srcMainWebapp) throws Exception { 
    188188        File srcMainWebappDir = new File(srcMainWebapp); 
    189189        if (srcMainWebappDir.exists() && srcMainWebappDir.isDirectory()) { 
    190190            File projectDir = srcMainWebappDir.getParentFile().getParentFile().getParentFile(); 
     191            File pomFile = LiveUtils.guessPom(srcMainWebapp); 
    191192            File target = new File(projectDir, "target"); 
    192             if (target.exists() && target.isDirectory()) { 
     193            if (pomFile != null && pomFile.exists() && target.exists() && target.isDirectory()) { 
     194                String artifactId = LiveUtils.getArtifactFromPom(pomFile); 
    193195                for (File file : target.listFiles()) { 
    194                     if (file.isDirectory()) { 
     196                    if (file.isDirectory() && file.getName().startsWith(artifactId)) { 
    195197                        File webInfDir = new File(file, "WEB-INF"); 
    196198                        if (webInfDir.exists())