Vertispan / j2clmavenplugin

Maven plugin to launch new J2CL compilation
https://vertispan.github.io/j2clmavenplugin/
Apache License 2.0
53 stars 26 forks source link

added optional configuration param 'translationsFile' that can be use… #149

Closed treblereel closed 2 years ago

treblereel commented 2 years ago

…d to pass XTB translation file to closure compiler

treblereel commented 2 years ago

hmm, looks like i have to revert my last commit (useFileConfig fix) coz it leads to:

[ERROR] Failed to execute goal com.vertispan.j2cl:j2cl-maven-plugin:0.20-SNAPSHOT:test (test-js) on project test: Failed to run tests: Bad artifact coordinates src/main/java/org/treblereel/test/MyTranslationBundle.xtb, expected format is <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version> -> [Help 1]

and it doesn't matter where i put MyTranslationBundle.xtb

niloc132 commented 2 years ago

That error comes when a) the string is first used as a set of maven coords, and if that fails, b) the string is used as a path to pick out a local file. The idea is that you might want to point at an external artifact

        public File readFile() {
            String pathOrCoords = readString();
            if (pathOrCoords == null) {
                return null;
            }
            File f;
            // try to resolve as maven coords first
            try {
                f = getFileWithMavenCoords(pathOrCoords);
            } catch (ArtifactResolutionException e) {
                // handle as a file instead
                f = new File(pathOrCoords);
            }
            log.debug(getPath() + " => " + f.getAbsolutePath());
            return f;
        }

Probably you need to specify ${project.baseDir}/src/... on your file, so that it is clear what the real path to the file is? I could see it being ambiguous, such as a generated xtb file from some other source, like merged properties files?

treblereel commented 2 years ago

@niloc132 thanks for youe reviews, now it works well with your https://github.com/Vertispan/j2clmavenplugin/pull/152 so i am going to rebase this branch with it once it ll be merged.

niloc132 commented 2 years ago

I approved this, but please be sure to file that issue.