You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Bruce Wen <cr...@gmail.com> on 2018/09/10 12:09:33 UTC

JDK Version for new project generated by mvn archetype:generate

Hi,

I used Maven 3.3.1. I created a new project with below commands:

mvn archetype:generate -DgroupId=my.company.project -DartifactId=my-project
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Then, I imported the generated project into eclipse and found it uses J2SE
-1.5.

My question:
How is J2SE-1.5 decided?
Can we specify JDK version for new project?

Thanks!
-- 
Bruce Wen (GuangMing)

Re: JDK Version for new project generated by mvn archetype:generate

Posted by Anders Hammar <an...@hammar.net>.
Yes.

A Maven project generated by an archetype typically needs some tweaking to
fit your needs.

/Anders

On Tue, Sep 11, 2018 at 4:28 PM Bruce Wen <cr...@gmail.com> wrote:

> >
> > In either case, you can after the Maven project has been generated change
> > the Java version to a version of your choice.
>
>
> Does that mean I have to do the change *AFTER *the project was generated?
>
> On Tue, Sep 11, 2018 at 1:48 PM Anders Hammar <an...@hammar.net> wrote:
>
> > The archetype is a template which either does explicitly configure
> > maven-compiler-plugin with a Java version. Or if not, the default (for
> the
> > used version of maven-compiler-plugin) value is used.
> >
> > In either case, you can after the Maven project has been generated change
> > the Java version to a version of your choice. To have Eclipse pick up the
> > change I think you need to right click on the project and select
> > Maven->Update project.
> >
> > /Anders
> >
> > On Tue, Sep 11, 2018 at 1:36 PM Bruce Wen <cr...@gmail.com> wrote:
> >
> > > >
> > > > It is configured on the maven-compiler-plugin [1].
> > >
> > >
> > > Do you mean archetype depends on maven-compiler-plugin? So, how can I
> > use a
> > > specific JDK version when I create a new project with archetype?
> > >
> > > Bruce Wen
> > >
> > > On Mon, Sep 10, 2018 at 2:20 PM Anders Hammar <an...@hammar.net>
> wrote:
> > >
> > > > The Java version is decided by the archetype you use. It is
> configured
> > on
> > > > the maven-compiler-plugin [1]. If not configured there is a default
> for
> > > > maven-compiler-plugin. The default depends on which version of
> > > > maven-compiler-plugin is used.
> > > >
> > > > When you import in Eclipse this configuration is read to configure
> the
> > > > Eclipse project.
> > > >
> > > > [1]
> > > >
> > > >
> > >
> >
> https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
> > > >
> > > > /Anders
> > > >
> > > > On Mon, Sep 10, 2018 at 2:09 PM Bruce Wen <cr...@gmail.com>
> wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I used Maven 3.3.1. I created a new project with below commands:
> > > > >
> > > > > mvn archetype:generate -DgroupId=my.company.project
> > > > -DartifactId=my-project
> > > > > -DarchetypeArtifactId=maven-archetype-quickstart
> > > -DinteractiveMode=false
> > > > >
> > > > > Then, I imported the generated project into eclipse and found it
> uses
> > > > J2SE
> > > > > -1.5.
> > > > >
> > > > > My question:
> > > > > How is J2SE-1.5 decided?
> > > > > Can we specify JDK version for new project?
> > > > >
> > > > > Thanks!
> > > > > --
> > > > > Bruce Wen (GuangMing)
> > > > >
> > > >
> > >
> > >
> > > --
> > > Bruce Wen (GuangMing)
> > >
> > >
> >
> -----------------------------------------------------------------------------------------------------------------
> > > "Undertake not what you cannot perform, but be careful to keep your
> > promise
> > > - George Washington"
> > >
> > >
> >
> -----------------------------------------------------------------------------------------------------------------
> > > Internet Email:crest.boy@gmail.com
> > > LinkedIn:cn.linkedin.com/in/wengm
> > > Blog:crest-boy.livejournal.com
> > > MSN:crest-boy@hotmail.com
> > >
> >
>
>
> --
> Bruce Wen (GuangMing)
>
> -----------------------------------------------------------------------------------------------------------------
> "Undertake not what you cannot perform, but be careful to keep your promise
> - George Washington"
>
> -----------------------------------------------------------------------------------------------------------------
> Internet Email:crest.boy@gmail.com
> LinkedIn:cn.linkedin.com/in/wengm
> Blog:crest-boy.livejournal.com
> MSN:crest-boy@hotmail.com
>

Re: JDK Version for new project generated by mvn archetype:generate

Posted by Thomas Broyer <t....@gmail.com>.
Either change the artifact (if you can) so it generates a pom.xml with the
appropriate source/target version [1], or indeed change the project pom.xml
(after it's been generated by the archetype)

[1] and possibly a profile for JDK 9+ that uses <release>, assuming the
target is <= 8; otherwise use <release> instead of <source>/<target>, and
no need for a profile.

On Tue, Sep 11, 2018 at 4:28 PM Bruce Wen <cr...@gmail.com> wrote:

> >
> > In either case, you can after the Maven project has been generated change
> > the Java version to a version of your choice.
>
>
> Does that mean I have to do the change *AFTER *the project was generated?
>
> On Tue, Sep 11, 2018 at 1:48 PM Anders Hammar <an...@hammar.net> wrote:
>
> > The archetype is a template which either does explicitly configure
> > maven-compiler-plugin with a Java version. Or if not, the default (for
> the
> > used version of maven-compiler-plugin) value is used.
> >
> > In either case, you can after the Maven project has been generated change
> > the Java version to a version of your choice. To have Eclipse pick up the
> > change I think you need to right click on the project and select
> > Maven->Update project.
> >
> > /Anders
> >
> > On Tue, Sep 11, 2018 at 1:36 PM Bruce Wen <cr...@gmail.com> wrote:
> >
> > > >
> > > > It is configured on the maven-compiler-plugin [1].
> > >
> > >
> > > Do you mean archetype depends on maven-compiler-plugin? So, how can I
> > use a
> > > specific JDK version when I create a new project with archetype?
> > >
> > > Bruce Wen
> > >
> > > On Mon, Sep 10, 2018 at 2:20 PM Anders Hammar <an...@hammar.net>
> wrote:
> > >
> > > > The Java version is decided by the archetype you use. It is
> configured
> > on
> > > > the maven-compiler-plugin [1]. If not configured there is a default
> for
> > > > maven-compiler-plugin. The default depends on which version of
> > > > maven-compiler-plugin is used.
> > > >
> > > > When you import in Eclipse this configuration is read to configure
> the
> > > > Eclipse project.
> > > >
> > > > [1]
> > > >
> > > >
> > >
> >
> https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
> > > >
> > > > /Anders
> > > >
> > > > On Mon, Sep 10, 2018 at 2:09 PM Bruce Wen <cr...@gmail.com>
> wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I used Maven 3.3.1. I created a new project with below commands:
> > > > >
> > > > > mvn archetype:generate -DgroupId=my.company.project
> > > > -DartifactId=my-project
> > > > > -DarchetypeArtifactId=maven-archetype-quickstart
> > > -DinteractiveMode=false
> > > > >
> > > > > Then, I imported the generated project into eclipse and found it
> uses
> > > > J2SE
> > > > > -1.5.
> > > > >
> > > > > My question:
> > > > > How is J2SE-1.5 decided?
> > > > > Can we specify JDK version for new project?
> > > > >
> > > > > Thanks!
> > > > > --
> > > > > Bruce Wen (GuangMing)
> > > > >
> > > >
> > >
> > >
> > > --
> > > Bruce Wen (GuangMing)
> > >
> > >
> >
> -----------------------------------------------------------------------------------------------------------------
> > > "Undertake not what you cannot perform, but be careful to keep your
> > promise
> > > - George Washington"
> > >
> > >
> >
> -----------------------------------------------------------------------------------------------------------------
> > > Internet Email:crest.boy@gmail.com
> > > LinkedIn:cn.linkedin.com/in/wengm
> > > Blog:crest-boy.livejournal.com
> > > MSN:crest-boy@hotmail.com
> > >
> >
>
>
> --
> Bruce Wen (GuangMing)
>
> -----------------------------------------------------------------------------------------------------------------
> "Undertake not what you cannot perform, but be careful to keep your promise
> - George Washington"
>
> -----------------------------------------------------------------------------------------------------------------
> Internet Email:crest.boy@gmail.com
> LinkedIn:cn.linkedin.com/in/wengm
> Blog:crest-boy.livejournal.com
> MSN:crest-boy@hotmail.com
>

Re: JDK Version for new project generated by mvn archetype:generate

Posted by Bruce Wen <cr...@gmail.com>.
>
> In either case, you can after the Maven project has been generated change
> the Java version to a version of your choice.


Does that mean I have to do the change *AFTER *the project was generated?

On Tue, Sep 11, 2018 at 1:48 PM Anders Hammar <an...@hammar.net> wrote:

> The archetype is a template which either does explicitly configure
> maven-compiler-plugin with a Java version. Or if not, the default (for the
> used version of maven-compiler-plugin) value is used.
>
> In either case, you can after the Maven project has been generated change
> the Java version to a version of your choice. To have Eclipse pick up the
> change I think you need to right click on the project and select
> Maven->Update project.
>
> /Anders
>
> On Tue, Sep 11, 2018 at 1:36 PM Bruce Wen <cr...@gmail.com> wrote:
>
> > >
> > > It is configured on the maven-compiler-plugin [1].
> >
> >
> > Do you mean archetype depends on maven-compiler-plugin? So, how can I
> use a
> > specific JDK version when I create a new project with archetype?
> >
> > Bruce Wen
> >
> > On Mon, Sep 10, 2018 at 2:20 PM Anders Hammar <an...@hammar.net> wrote:
> >
> > > The Java version is decided by the archetype you use. It is configured
> on
> > > the maven-compiler-plugin [1]. If not configured there is a default for
> > > maven-compiler-plugin. The default depends on which version of
> > > maven-compiler-plugin is used.
> > >
> > > When you import in Eclipse this configuration is read to configure the
> > > Eclipse project.
> > >
> > > [1]
> > >
> > >
> >
> https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
> > >
> > > /Anders
> > >
> > > On Mon, Sep 10, 2018 at 2:09 PM Bruce Wen <cr...@gmail.com> wrote:
> > >
> > > > Hi,
> > > >
> > > > I used Maven 3.3.1. I created a new project with below commands:
> > > >
> > > > mvn archetype:generate -DgroupId=my.company.project
> > > -DartifactId=my-project
> > > > -DarchetypeArtifactId=maven-archetype-quickstart
> > -DinteractiveMode=false
> > > >
> > > > Then, I imported the generated project into eclipse and found it uses
> > > J2SE
> > > > -1.5.
> > > >
> > > > My question:
> > > > How is J2SE-1.5 decided?
> > > > Can we specify JDK version for new project?
> > > >
> > > > Thanks!
> > > > --
> > > > Bruce Wen (GuangMing)
> > > >
> > >
> >
> >
> > --
> > Bruce Wen (GuangMing)
> >
> >
> -----------------------------------------------------------------------------------------------------------------
> > "Undertake not what you cannot perform, but be careful to keep your
> promise
> > - George Washington"
> >
> >
> -----------------------------------------------------------------------------------------------------------------
> > Internet Email:crest.boy@gmail.com
> > LinkedIn:cn.linkedin.com/in/wengm
> > Blog:crest-boy.livejournal.com
> > MSN:crest-boy@hotmail.com
> >
>


-- 
Bruce Wen (GuangMing)
-----------------------------------------------------------------------------------------------------------------
"Undertake not what you cannot perform, but be careful to keep your promise
- George Washington"
-----------------------------------------------------------------------------------------------------------------
Internet Email:crest.boy@gmail.com
LinkedIn:cn.linkedin.com/in/wengm
Blog:crest-boy.livejournal.com
MSN:crest-boy@hotmail.com

Re: JDK Version for new project generated by mvn archetype:generate

Posted by Anders Hammar <an...@hammar.net>.
The archetype is a template which either does explicitly configure
maven-compiler-plugin with a Java version. Or if not, the default (for the
used version of maven-compiler-plugin) value is used.

In either case, you can after the Maven project has been generated change
the Java version to a version of your choice. To have Eclipse pick up the
change I think you need to right click on the project and select
Maven->Update project.

/Anders

On Tue, Sep 11, 2018 at 1:36 PM Bruce Wen <cr...@gmail.com> wrote:

> >
> > It is configured on the maven-compiler-plugin [1].
>
>
> Do you mean archetype depends on maven-compiler-plugin? So, how can I use a
> specific JDK version when I create a new project with archetype?
>
> Bruce Wen
>
> On Mon, Sep 10, 2018 at 2:20 PM Anders Hammar <an...@hammar.net> wrote:
>
> > The Java version is decided by the archetype you use. It is configured on
> > the maven-compiler-plugin [1]. If not configured there is a default for
> > maven-compiler-plugin. The default depends on which version of
> > maven-compiler-plugin is used.
> >
> > When you import in Eclipse this configuration is read to configure the
> > Eclipse project.
> >
> > [1]
> >
> >
> https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
> >
> > /Anders
> >
> > On Mon, Sep 10, 2018 at 2:09 PM Bruce Wen <cr...@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > I used Maven 3.3.1. I created a new project with below commands:
> > >
> > > mvn archetype:generate -DgroupId=my.company.project
> > -DartifactId=my-project
> > > -DarchetypeArtifactId=maven-archetype-quickstart
> -DinteractiveMode=false
> > >
> > > Then, I imported the generated project into eclipse and found it uses
> > J2SE
> > > -1.5.
> > >
> > > My question:
> > > How is J2SE-1.5 decided?
> > > Can we specify JDK version for new project?
> > >
> > > Thanks!
> > > --
> > > Bruce Wen (GuangMing)
> > >
> >
>
>
> --
> Bruce Wen (GuangMing)
>
> -----------------------------------------------------------------------------------------------------------------
> "Undertake not what you cannot perform, but be careful to keep your promise
> - George Washington"
>
> -----------------------------------------------------------------------------------------------------------------
> Internet Email:crest.boy@gmail.com
> LinkedIn:cn.linkedin.com/in/wengm
> Blog:crest-boy.livejournal.com
> MSN:crest-boy@hotmail.com
>

Re: JDK Version for new project generated by mvn archetype:generate

Posted by Bruce Wen <cr...@gmail.com>.
>
> It is configured on the maven-compiler-plugin [1].


Do you mean archetype depends on maven-compiler-plugin? So, how can I use a
specific JDK version when I create a new project with archetype?

Bruce Wen

On Mon, Sep 10, 2018 at 2:20 PM Anders Hammar <an...@hammar.net> wrote:

> The Java version is decided by the archetype you use. It is configured on
> the maven-compiler-plugin [1]. If not configured there is a default for
> maven-compiler-plugin. The default depends on which version of
> maven-compiler-plugin is used.
>
> When you import in Eclipse this configuration is read to configure the
> Eclipse project.
>
> [1]
>
> https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
>
> /Anders
>
> On Mon, Sep 10, 2018 at 2:09 PM Bruce Wen <cr...@gmail.com> wrote:
>
> > Hi,
> >
> > I used Maven 3.3.1. I created a new project with below commands:
> >
> > mvn archetype:generate -DgroupId=my.company.project
> -DartifactId=my-project
> > -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
> >
> > Then, I imported the generated project into eclipse and found it uses
> J2SE
> > -1.5.
> >
> > My question:
> > How is J2SE-1.5 decided?
> > Can we specify JDK version for new project?
> >
> > Thanks!
> > --
> > Bruce Wen (GuangMing)
> >
>


-- 
Bruce Wen (GuangMing)
-----------------------------------------------------------------------------------------------------------------
"Undertake not what you cannot perform, but be careful to keep your promise
- George Washington"
-----------------------------------------------------------------------------------------------------------------
Internet Email:crest.boy@gmail.com
LinkedIn:cn.linkedin.com/in/wengm
Blog:crest-boy.livejournal.com
MSN:crest-boy@hotmail.com

Re: JDK Version for new project generated by mvn archetype:generate

Posted by Anders Hammar <an...@hammar.net>.
The Java version is decided by the archetype you use. It is configured on
the maven-compiler-plugin [1]. If not configured there is a default for
maven-compiler-plugin. The default depends on which version of
maven-compiler-plugin is used.

When you import in Eclipse this configuration is read to configure the
Eclipse project.

[1]
https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html

/Anders

On Mon, Sep 10, 2018 at 2:09 PM Bruce Wen <cr...@gmail.com> wrote:

> Hi,
>
> I used Maven 3.3.1. I created a new project with below commands:
>
> mvn archetype:generate -DgroupId=my.company.project -DartifactId=my-project
> -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
>
> Then, I imported the generated project into eclipse and found it uses J2SE
> -1.5.
>
> My question:
> How is J2SE-1.5 decided?
> Can we specify JDK version for new project?
>
> Thanks!
> --
> Bruce Wen (GuangMing)
>

Re: JDK Version for new project generated by mvn archetype:generate

Posted by dathewolf <da...@gmail.com>.
Hi i think you go in the pom.xmlThen précise the language level. Or see project settings in eclipse.


Envoyé depuis mon smartphone Samsung Galaxy.
-------- Message d'origine --------De : Bruce Wen <cr...@gmail.com> Date : 10/09/18  14:09  (GMT+01:00) À : Maven Users List <us...@maven.apache.org> Objet : JDK Version for new project generated by mvn archetype:generate 
Hi,

I used Maven 3.3.1. I created a new project with below commands:

mvn archetype:generate -DgroupId=my.company.project -DartifactId=my-project
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Then, I imported the generated project into eclipse and found it uses J2SE
-1.5.

My question:
How is J2SE-1.5 decided?
Can we specify JDK version for new project?

Thanks!
-- 
Bruce Wen (GuangMing)