I'm encountering 404 error messages when trying to view attachments of a 
maven 3 project using Jenkins 1.540, with junit-attachment plugin version 
1.3

I've noticed that the junit-attachments plugin publishes the attachments it 
finds to a path like this:
.../work/jobs/simple-failing-project/builds/2013-11-25_10-57-02//junit-attachments/Math.MathTest/test1ple2.math

However, when the attachment is linked in the test results web page, the 
path is:
http://localhost:8080/jenkins/job/simple-failing-project/simple-failing-project$simple-failing-project/16/testReport/Math/MathTest/attachments/test1ple2.math

Notice the maven module name that is inserted into that URL path? I've seen 
during debugging that the AbstractBuild instance given to 
the 
hudson.plugins.junitattachments.AttachmentPublisher.getTestData(AbstractBuild<?,
 
?>, Launcher, BuildListener, TestResult) method is an instance of 
MavenModuleSetBuild, but during TestAction rendering for the test results 
page, the AbstractBuild found from testObject.getOwner is a MavenBuild.

So the difference in MavenModuleSetBuild and MavenBuild is such that the 
value returned from the getRootDir() method changes. Where the later 
includes the module path. I searched backwards, and found an interesting 
for loop in hudson.maven.MavenTestDataPublisher.perform(AbstractBuild<?, 
?>, Launcher, BuildListener):

        for (MavenBuild moduleBuild : moduleLastBuilds.values()) {
            SurefireReport report = 
moduleBuild.getAction(SurefireReport.class);
            if (report == null) {
                continue;
            }
            List<Data> data = new ArrayList<Data>();
            if (getTestDataPublishers() != null) {
                for (TestDataPublisher tdp : getTestDataPublishers()) {
                    Data d = tdp.getTestData(build, launcher, listener, 
report.getResult());
                    if (d != null) {
                        data.add(d);
                    }
                }
            }
            if (!data.isEmpty()) {
                report.setData(data);
                moduleBuild.save();
            }
        }



This loop ends up calling tdp.getTestData(...) for every module, but with 
the same _build_ instance. Which is of course a MavenModuleSetBuild.  Would 
it be more appropriate to pass the current value of _moduleBuild_ into 
tdp.getTestData(...)? 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to