I figgured out that mavens build extension deployatend has some problems to deploy if some modules using the odavid.mixin.plugin.
I get following message for all modules:
[INFO] Deploying module.xy at end
After last module in the reactor build was execute it should deploy but i get the same information - "Deploying at end"
By removing the part with the mixin.plugin it deploys successfully.
My maven verison is 3.2.5 and i use the maven.deploy.plugin 2.8.2.
I think it deppends on the merged effective-pom by the mixin, which cause a broken module counter so that the if clause cant reached at runtime (attached maven snipped).
Can someone confirm that problem and is there any solution before i try to bugfix that problem?
boolean projectsReady = READYPROJECTSCOUNTER.incrementAndGet() == reactorProjects.size();
if ( projectsReady )
{
synchronized ( DEPLOYREQUESTS )
{
while ( !DEPLOYREQUESTS.isEmpty() )
{
ArtifactRepository repo = getDeploymentRepository( DEPLOYREQUESTS.get( 0 ) );
deployProject( getSession().getProjectBuildingRequest(), DEPLOYREQUESTS.remove( 0 ), repo );
}
}
}
else if ( addedDeployRequest )
{
getLog().info( "Deploying " + project.getGroupId() + ":" + project.getArtifactId() + ":"
+ project.getVersion() + " at end" );
}
Related
I'm working on a maven build pipeline.
Currently I'm facing the problem that a maven project is still building if a dependency is invalid.
I think everyone know that warning in the log:
[WARNING] The POM for is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details.
I would like to fail the project instead of a warning because in a big build pipeline its hard to find.
I looked into the code:
The warning happens in maven-core because of an EventType.ARTIFACT_DESCRIPTOR_INVALID.
In the DefaultArtifactDescriptorReader I found that during building the effective model the ModelBuildingException is catched.
There is a ArtifactDescriptorPolicy. Based on that a exception will be added or only the EventType.ARTIFACT_DESCRIPTOR_INVALID is fired (see invalidDescriptor()).
model = modelBuilder.build( modelRequest ).getEffectiveModel();
}
catch ( ModelBuildingException e )
{
for ( ModelProblem problem : e.getProblems() )
{
if ( problem.getException() instanceof UnresolvableModelException )
{
result.addException( problem.getException() );
throw new ArtifactDescriptorException( result );
}
}
invalidDescriptor( session, trace, a, e );
if ( ( getPolicy( session, a, request ) & ArtifactDescriptorPolicy.IGNORE_INVALID ) != 0 )
{
return null;
}
result.addException( e );
throw new ArtifactDescriptorException( result );
}
I didn't found any option to configure the ArtifactDescriptorPolicy.
I expect that the ArtifactDescriptorPolicy.STRICT would solve my problem.
Does anyone knows more about that problem?
I think you're a bit ahead of the curve. There is a feature (new switch) in Maven 4 called --fail-on-severity or -fos that does exactly this: fail the build on a specific severity.
$ mvn -fos WARN clean install
If you don't mind being on the bleeding edge, you could install it and give it a go.
I am using the gradle-svntools-plugin to attempt to update my svn source etc. but am getting the following error when executing the task
A problem occurred evaluating root project 'XBRLReports'.
Cannot cast object '12345' with class 'java.lang.String' to class 'java.lang.Long'
Here is the task in question :
task updateSource(type: SvnUpdate){
username = svn_username
password = svn_password
if ( project.hasProperty("rev") ) {
revision = rev
println "Revision --- $rev"
}
doLast{
println "Revision --- " + revision
}
}
The issue arises when I try and pass a command line variable like so
gradlew updateSource -Prev=12345
Manually setting revision to a static value also causes the issue. Printing out the value of revision returns null. I am not sure if this is a bug or if I am not properly using the plugin. The documentation is vague for this task. Here is the link to it --
gradle-svntools-plugin SvnUpdate
I have opened a ticket on github as well.
Thank you
Try this :
if ( project.hasProperty("rev") ) {
revision = rev.toLong()
println "Revision --- $rev"
}
I'm going to put a fat bounty on this as soon as the system permits.
What I'm specifically having trouble with is getting coverage and getting integration tests working. For these I see the uninformative error:
Resource not found: com.something.somethingelse.SomeITCase
Uninformative because there's nothing to relate it to, nor does it mean much to someone who has none of the context.
Here's other weirdness I'm seeing. In cases where there's no integration tests for a subproject, I see this:
JaCoCoItSensor: JaCoCo IT report not found: /dev/build/dilithium/target/jacoco-it.exec
Why would I see target? This isn't a Maven project. A global search shows there's no target directory mentioned anywhere in the code base.
Then, there's this section of the documentation:
sonarqube {
properties {
properties["sonar.sources"] += sourceSets.custom.allSource.srcDirs
properties["sonar.tests"] += sourceSets.integTest.allSource.srcDirs
}
}
Near as I can tell sourceSets.integTest.allSource.srcDirs returns Files, not Strings. Also it should be:
sonarqube {
properties {
property "sonar.tests", "comma,separated,file,paths"
}
Note that you get an error if you have a directory in there that doesn't exist. Of course there's apparently no standard for what directory to put integration tests in and for some sub-projects they may not even exist. The Gradle standard would be to simply ignore non-existent directories. Your code ends up looking like:
sonarqube {
StringBuilder builder = new StringBuilder()
sourceSets.integrationTest.allSource.srcDirs.each { File dir ->
if ( dir.exists() ) {
builder.append(dir.getAbsolutePath())
builder.append(",")
}
}
if (builder.size() > 1) builder.deleteCharAt(builder.size() -1 )
if (builder.size() > 1 )
properties["sonar.tests"] += builder.toString()
properties["sonar.jacoco.reportPath"] +=
"$project.buildDir/jacoco/test.exec,$project.buildDir/jacoco/integrationTest.exec"
}
Sonar is reporting no coverage at all. If I search for the *.exec files, I see what I would expect. That being:
./build/jacoco/test.exec
./build/jacoco/integrationTest.exec
...but weirdly, I also see this:
./build/sonar/com.proj_name_component_management-component_proj-recordstate/jacoco-overall.exec
What is that? Why is it in such a non-standard location?
OK, I've added this code:
properties {
println "Before: " + properties.get("sonar.tests")
println "Before: " + properties.get("sonar.jacoco.reportPath")
property "sonar.tests", builder.toString()
property "sonar.jacoco.reportPath", "$project.buildDir/jacoco/test.exec,$project.buildDir/jacoco/integrationTest.exec"
println "After: " + properties.get("sonar.tests")
println "After: " + properties.get("sonar.jacoco.reportPath")
}
...which results in:
[still running]
I don't want any bounty or any points.
Just a suggestion.
Can you get ANY Jacoco reports at all?
Personally I would separate the 2: namely Jacoco report generation and Sonar.
I would first try to simply generate Jacoco THEN I would look at why Sonar can not get a hold of them.
I am using gradle to manager my project and I use gradle test --tests XXXX command to run a single test class. I wander where I can find the console output of my test cases. I know that there is a directory test-results under build which has all test cases result. But it only has the results when the test case finished. If my case is running hours and I want to monitor the output, where I can find them?
There is Test.onOutput method:
apply plugin: 'java'
test {
onOutput {
descriptor, event
-> if( event.destination == TestOutputEvent.Destination.StdErr ) {
logger.error( "Test: "
+ descriptor
+ ", error: "
+ event.message)
} } }
I am on page 78 of the gradle userguide: Example 14.5. Configuring arbitrary objects using a script.
I have copied all of the code in the example:
build.gradle
task configure << {
pos = java.text.FieldPosition( ) new 10
// Apply the script
apply from: 'other.gradle', to: pos
println pos.beginIndex
println pos.endIndex
}
other.gradle
beginIndex = 1;
endIndex = 5;
Output of gradle -q configure
D:\Gradle\ThisAndThat>gradle -q configure
FAILURE: Build failed with an exception.
Where: Build file 'D:\Gradle\ThisAndThat\build.gradle' line: 1
What went wrong: Could not compile build file 'D:\Gradle\ThisAndThat\build.gradle'.
> startup failed:
build file 'D:\Gradle\ThisAndThat\build.gradle': 1: expecting EOF, found 'configure' # line 1, column 6.
task configure << { ^
1 error
I cannot figure out why I am getting this error. Any help would be appreciated. Thanks!
When I literally copy the code from Chapter 14.5 of the userguide it works. Your mistake is in the build.gradle script:
task configure << {
pos = java.text.FieldPosition( ) new 10
should be
task configure << {
pos = new java.text.FieldPosition(10)