Here's a radical idea to simplify the usage of Maven, especially when considering Eclipse cooperation.
How about not using test scope, but instead create a 'project-test' for every 'project'? Some advantages:
The pom.xml files will be cleaner.
The single-classpath Eclipse will not be a problem any more.
One will not have to think about the interaction between the declared dependency scope and the importing dependency scope. (Unfortunately, the 'provided' scope is still needed, but that is pretty simple.)
If one would want to import test code into another project, no need to fiddle with '-tests' attachment.
One can build with-out tests, which is quicker, and could likely allow tests to be run quicker, ironically, because of parallel execution. Or you could collect all tests before running them.
The odd thing is that maven wasn't designed this way from the start. It would have dispensed with a lot of extra complexity. Etcetera.
Software development woes. Java-based development in particular. Also, philosophizing, architecture, design.
Showing posts with label pom. Show all posts
Showing posts with label pom. Show all posts
Friday, December 14, 2012
Thursday, December 13, 2012
Maven Source Properties That Don't Work
When I do 'Maven > Update Project Configuration' in Eclipse, this seems not to work:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.source>1.6</project.build.source>
<project.build.target>1.6</project.build.target>
</properties>
But this seems to work:
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
...
Too bad, since the first xml is neater.
---
PS. One sign that there is some mix-up with 1.5/1.6, is that the @Override annotation acts up.
Labels:
.classpath,
compiler,
configuration,
Eclipse,
maven,
plugin,
pom,
source,
version
Monday, November 12, 2012
Fix Maven Source Version Having No Effect
In a recent article at http://impossible-is-development.blogspot.com/2012/11/basic-maven-project-build-fix-tip.html, I wrote about a trick to get the .classpath file to reflect the src/main/java etcetera build structure. This trick actually helps in another not-to-uncommon situation: unsyncronized source versions.
Now; if you add this to an existing pom.xml, Eclipse may fail to take note of this change automatically. Maybe it never takes note. In any case, the same solution applies here as in the earlier blog post: just disable and enable dependency management.
If you create a new pom.xml, it may happen that there is no Java versions information given. The version can be given in two ways; via some xml using a 'properties' tag, or via more xml.
Plugin config:
Sorry about the formatting. (Doesn't the Blogger editor suck something awful for quotes and code? ...hmm...can one blog on Github?)<build><plugins><plugin>maven-compiler-plugin <configuration><source>1.6</source><target>1.6</target></configuration></plugin></plugins>
<project.build.source>1.6</project.build.source>
<project.build.target>1.6</project.build.target>
(Again, sorry about the formatting.)Now; if you add this to an existing pom.xml, Eclipse may fail to take note of this change automatically. Maybe it never takes note. In any case, the same solution applies here as in the earlier blog post: just disable and enable dependency management.
Labels:
dependency management,
disable-enable,
Eclipse,
maven,
pom,
pom.xml,
source,
synch,
tip,
tricks,
version
Thursday, October 25, 2012
Maven Dependency Type 'jar' Not Added Automatically
After a half-hour or so of not understanding why some Java imports didn't work.
I noticed that the letters 'jar' was missing from the dependency listing.
I had tried using the Eclipse maven assist GUI to add a dependency.
And apparently the it's not enough to just search for the dependency and say OK when selected.
Which is Odd because I've done it a few times and it's worked fine.
All these little things.
All. These. Little. Things.
That.
Add.
Up.
To.
A.
Large Amount Of Wasted Life And Time And Money.
I noticed that the letters 'jar' was missing from the dependency listing.
I had tried using the Eclipse maven assist GUI to add a dependency.
And apparently the it's not enough to just search for the dependency and say OK when selected.
Which is Odd because I've done it a few times and it's worked fine.
All these little things.
All. These. Little. Things.
That.
Add.
Up.
To.
A.
Large Amount Of Wasted Life And Time And Money.
Subscribe to:
Posts (Atom)