I tried modifying the VehicleRoutingSolutionPainter.java file in Optaplanner to display some other information too. However, building using Maven by executing mvn -DskipTests clean install throws following build error:
Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check on project optaplanner-examples: Failed during checkstyle execution
I then removed the edits I made to the java file. However, it still throws the same error. How do I make modifications to the java file?
Thanks
Checkstyle is (packaged into) a Maven plugin used for checking code formatting issues -- OptaPlanner uses it in order for the code to look uniform all across the code base. You have two options on how to proceed:
If you just want to make edits for your own purpose (and don't care about code formatting, I suggest out-commenting the maven-checkstyle-plugin in the main OptaPlanner pom.xml file (currently lines 83-171 in the file).
Or, you can fix the formatting errors that checkstyle reports (see the checkstyle log and/or the lines below the error you posted in the console). You will have to do this if you want your changes to get merged back into OptaPlanner source code.
The reason why when you reverted the changes checkstyle was still unhappy is, that you probably left in some excessive whitespace, or failed to add a new line at the end of the file, or something similar.
Related
By default, IntelliJ IDEA puts Kotlin source files for package foo in src/*.kt but Gradle isn't happy with that; it can only see them if they go in src/main/kotlin/foo/*.kt.
I've tried moving them there, but now IDEA gives a warning in my source files, in the package foo line, saying 'package directive doesn't match file location' and wanting to change the package to main.kotlin.foo (which of course would be incorrect, and probably confuse Gradle again).
How do you get the two to agree on where the files should go? (Ideally I would like it to be somewhere that doesn't have any levels of empty subdirectories, but I will settle for anything the two programs can agree on.)
It turns out that if you just delete the IDEA configuration, IDEA will automatically rebuild it from the Gradle project, and thereby become happy with the Gradle default layout.
Latest:
This is definitely a bug in msbuild. Other than that there cannot be any other explanation. This could only be happening on Linux or possibly on a wider range.
So i decided to just build one single project with absolutely no dependencies on others in the solution.
Looking at the captured diagnostics, I see these lines which are very promising:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
Input files: Annotations.cs;Auth.cs;AuthorizationConfig.cs;Backend.cs;Billing.cs;Code.cs;...
Output files: .obj/TheAgent.dll;.obj/TheAgent.pdb
Set Property: NoWarn=;1701;1702
15:23:27.396 1>Done building target "CoreCompile" in project "TheAgent.csproj".: (TargetId:40)
It looks like my dll and my pdb weren't built which is what I expected.
However, something must be happening before or after causing the timestamp to change (be that of this build time and not the last).
The timestamp of the dll is updated both in the intermediate object folder (.obj/) and also in the output folder.
Is there a known way of stopping msbuild right after its CoreCompile task?
Update:
I decided to search for is newer this time and found instances of these. I don't know how they have got to the solution/project files though:
Input file ".obj/Common.csproj.CoreCompileInputs.cache" is newer than output file ".obj/Common.pdb".
Further to the above, I came across this:
https://github.com/dotnet/project-system/issues/4736
Thinking that this was the issue, I upgraded to dotnet sdk version 2.2.402.
The end result is still the same :(
Original:
I need some pointers on how to troubleshoot this issue. I am using /t:build to build a solution file.
The resulting executable keeps getting refreshed each time.
First i thought the package restore was causing this. I have removed that step however it didn't make a difference.
Then I looked at this:
https://oz-code.com/blog/visual-studio-keeps-rebuilding-projects-no-good-reason/
I'm basically looking for some text in the diagnostics output which tells me if a target or a file is out of date and needs to be rebuilt. The above link talks about "project 'B' is not up to date". I don't have a not up to date in my msbuild output.
I already had two resources with CopyAlways which I changed to CopyIfNewer.
The above article also talks about circular dependencies. I am checking everything manually. And yes the references to dependent project are actually references to the project outputs (dll's /exe's). So Finding a circular dependency by just checking for that pattern seems a little odd.
There was one more problems in the dotnet platform and/or msbuild causing this to fail.
One of those was this https://github.com/dotnet/project-system/issues/4736
Installing SDK 3.0.100-preview7-012821 or better solved the problem
I have defined my Dagger2 component file in a class named LpComponent.java so I need to instantiate things using DaggerLpComponent class reference.
However when I update LpComponent.java file DaggerLpComponent is not getting recreated , only way I can get this is to clean the whole project, and rebuild it.
Is there good old make style dependency I can specify DaggerLpComponent.java depends on LpComponent.java?
Also its not clear to be what rule generates DaggerLpComponent.java file. I have tried ./gradlew tasks to see if there is some dagger specific task that generates the file, but didn't see anything..
Dagger 2 works via annotation processing, which happens at compile time. A simple compilation of your project should trigger the Dagger 2 annotation processor to run and generate new sources. With Android, that should be minimally one of the tasks starting with "compile" that has your build type and flavor in the name.
In a simple IntelliJ module, I just want to generate a .jar file with my .class files, via IntelliJ IDE commands.
Please be careful before marking this as a "duplicate":
Although I've seen Google and Stack hits with promising titles, I'm not finding a really good answer, or the title is misleading, or its an unanswered question. I cover one possible answer that I've seen before (below), and why I don't think it's a match.
I've used Eclipse in the past, but I'm rather new to IntelliJ.
I've worked with the "Project Structure / Artifacts" stuff. I can generate the giant jar, similar to using "shade", but it's huge because it includes all the nested dependencies. We want the small jar with just this module's class files because the system we're deploying to already has all the other jars in place.
I've seen some references to changing a target directory in the Artifacts dialog box, but it then talks about references being made in the Manifest file, which I don't want. The destination environment already has its java paths setup, so I'm worried that having jar references in this jar will mess that up. If this really is the answer then I'm confused about how it works.
Constraint 1: Can't use command line tools, since I'm actually walking somebody else through these steps, who likely doesn't have command line tools installed in the path, or wouldn't know how to use them, etc. They're not a coder. (Yes, I know this sounds like an odd scenario; I inherited this situation.)
Constraint 2: We want to keep this as a simple IntelliJ project, vs. converting to Maven or Ant or Gradle, etc.
Coworker had the fix.
Short Answer:
Remove all of the other jars/libraries from Output Layout tab of the Artifacts config dialog.
Longer Answer:
You still do File / Project Structure...
Then in the Project Settings, click Artifacts.
And then you still click the plus button (second column) ti create a new artifact setting.
The trick is the "Output Layout" tab in the third column of the window. Highlight all entries EXCEPT the compiled output of your project and delete all those other entries (click the minus button under that tab, directly above your_project.jar)
On my laptop this causes it to pause for a few seconds; I thought it didn't do anything, then finally it reflected that everything was gone except "'my_module' compile output"
Also check the "Build on make" (for when you later do Build / Rebuild Project)
If you need both a full jar and a slim jar, you can have more than one Artifact configuration with different names, and they will default to different output directories.
I'm working with gendarme for .net called by Sonar (launched by Jenkins).
I've a lot of AvoidVisibleFieldsRule violations. The main violations are found in the generated files. As I can't do anything on it, i would like to exclude *.designer.cs from the scan.
I can't find a way to do that. There is a properties in Sonar to exclude generated files but it doesn't seem to be applied for gendarme.
Is there a way to do such a thing ?
Thanks for all
Gendarme expects you provide an ignore list,
http://www.mono-project.com/Gendarme.FAQ
https://github.com/mono/mono-tools/blob/master/gendarme/self-test.ignore
The ignore file format is bit of weird, but you can learn it by experiments.
Indeed that is actually not normal at all. Generated code is excluded by the plugin with the standard configuration. What version of the C# plugins are you using ?
Anyway, the configuration property you can try is "sonar.exclusions" (see http://docs.codehaus.org/display/SONAR/Advanced+parameters).
If you do not solve your problem right away, the best thing would be to drop a mail to the user mailing list (see http://www.sonarsource.org/support/support/) and send the verbose output of your build. To get this output simply add "-X" to the command line.
Hope it helps