You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by dlots <im...@gmail.com> on 2012/02/05 22:06:46 UTC

Maven errors on compilation of files with missing imports (files that are not called by the application) compile phase

I have a project and a shared folder that is common to all my projects that
includes classes that are not necessarily used (and therefore) complete for
all projects. When executing the compile phase, it is erroring because some
of the files in the shared folder which is added with the
builder-helper-maven-plugin have missing dependencies because these files
are not used in this particular project. 

However, it appears that executing the target compiler:compile does a
different type of compile, for one thing not executing the generate-sources
phase. So i guess executing a specific target with maven does not execute
all previous target in the lifecycle?

It appears that running "mvn generate-source compiler:compile" works. It
does not error on missing imports in uncalled classes. Can you clarify why
the compile phase attempts to validate all classes in the src directories,
including ones not used in the application? The eclipse builder for example
does not attempt to validate all classes, while the intellij builder does I
believe.

--
View this message in context: http://maven.40175.n5.nabble.com/Maven-errors-on-compilation-of-files-with-missing-imports-files-that-are-not-called-by-the-applicatie-tp5458721p5458721.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven errors on compilation of files with missing imports (files that are not called by the application) compile phase

Posted by dlots <im...@gmail.com>.
This is bizarre. It appears that I ran exec:java (or compile) and it
generated class files in the target/classes folder just like in the other
project and maven claimed that all files are up to date. I don't know what I
did to generate the class files. I did a mvn clean deleting the class files
and maven is again erroring on compilation because it no longer has the
class files. Perhaps eclipse's builder was triggered to compile the project?

--
View this message in context: http://maven.40175.n5.nabble.com/Maven-errors-on-compilation-of-files-with-missing-imports-files-that-are-not-called-by-the-applicatie-tp5458721p5459920.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven errors on compilation of files with missing imports (files that are not called by the application) compile phase

Posted by dlots <im...@gmail.com>.
It appears that maven is validating the classes for missing dependencies
regardless of calling compiler:compile or the compile phase. This was not
the case previously somehow before my eclipse crashed. I even have the
compiled classes for a different project including all of the shared
classes. What can possibly be causing maven to validate the imports?

--
View this message in context: http://maven.40175.n5.nabble.com/Maven-errors-on-compilation-of-files-with-missing-imports-files-that-are-not-called-by-the-applicatie-tp5458721p5459880.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven errors on compilation of files with missing imports (files that are not called by the application) compile phase

Posted by dlots <im...@gmail.com>.
Maven isn't a very big piece of software so if someone has a good answer for
this, I would greatly appreciate it. 

--
View this message in context: http://maven.40175.n5.nabble.com/Maven-errors-on-compilation-of-files-with-missing-imports-files-that-are-not-called-by-the-applicatie-tp5458721p5459454.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven errors on compilation of files with missing imports (files that are not called by the application) compile phase

Posted by Barrie Treloar <ba...@gmail.com>.
On Mon, Feb 6, 2012 at 12:52 PM, dlots <im...@gmail.com> wrote:
> Can you clarify why the compile phase attempts to validate all classes in the
> src directories, including ones not used in the application? The eclipse
> builder for example does not attempt to validate all classes, while the
> intellij builder does I believe.
>
> That's the main question.

Not really.

Those are internals of Maven and are not really meant to be called by
themselves.
That's why Maven has a lifecycle  - to remove that burden from you.

Do you care how an engine in your car works? Or do you just know that
when you press the accelerator pedal the car goes forward?

You have better things to work on, like your own project, than trying
to get Maven to work the way you want it to.
People will quote at you "Don't fight against Maven, you'll loose".
You will have a much more enjoyable experience by gaining a little
knowledge (see the free books) and to follow the well worn path Maven
has made for you.

We are here to help you if the path needs repairing, but I think you
wont have much luck if you want to go through the jungle.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven errors on compilation of files with missing imports (files that are not called by the application) compile phase

Posted by dlots <im...@gmail.com>.
Can you clarify why the compile phase attempts to validate all classes in the
src directories, including ones not used in the application? The eclipse
builder for example does not attempt to validate all classes, while the
intellij builder does I believe. 

That's the main question. 

--
View this message in context: http://maven.40175.n5.nabble.com/Maven-errors-on-compilation-of-files-with-missing-imports-files-that-are-not-called-by-the-applicatie-tp5458721p5459225.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven errors on compilation of files with missing imports (files that are not called by the application) compile phase

Posted by dlots <im...@gmail.com>.
I'm not going to do that. Can you please answer the specific questions about
the compile phase?

--
View this message in context: http://maven.40175.n5.nabble.com/Maven-errors-on-compilation-of-files-with-missing-imports-files-that-are-not-called-by-the-applicatie-tp5458721p5459223.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven errors on compilation of files with missing imports (files that are not called by the application) compile phase

Posted by Barrie Treloar <ba...@gmail.com>.
On Mon, Feb 6, 2012 at 7:36 AM, dlots <im...@gmail.com> wrote:
> I have a project and a shared folder that is common to all my projects that
> includes classes that are not necessarily used (and therefore) complete for
> all projects. When executing the compile phase, it is erroring because some
> of the files in the shared folder which is added with the
> builder-helper-maven-plugin have missing dependencies because these files
> are not used in this particular project.
[del]

I recommend you read the books on Maven http://maven.apache.org/articles.html.
What you are doing is going against the way Maven works, and you will lose.
Its best to accept the conventions Maven proposes and make your life happy.

What you want to do is to pull out your shared folder into separate
projects, one for each different functionality.
You then get maven to build those into jars which are installed into a
Maven Repository Manager so that others can obtain them.
Now your projects can explicitly specify just the stuff they actually depend on.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org