Solved! Maven new project doesn't get java files build, why?
up vote
-1
down vote
favorite
[I got it, the tag should be modified to "jar". Fixed!]
I've tried this on both ubuntu and mac, doesn't work. I've Apache Maven 3.5.2 and jdk 1.8
(1) create a directory called mytest and enter:
mkdir mytest
cd mytest
(2) create folder structure of src/main/java
mkdir -p src/main/java
(3) create pom file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.mytest</groupId>
<artifactId>mytest</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
</project>
and a java file of "./src/main/java/m.java"
public class m
public static void main(String args)
System.out.println("hw");
(4) Now the structure is like:
.
./src
./src/main
./src/main/java
./src/main/java/m.java
./pom.xml
(5) mvn clean compile:
$ mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mytest 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ mytest ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.271 s
[INFO] Finished at: 2018-11-10T01:19:27-08:00
[INFO] Final Memory: 7M/188M
[INFO] ------------------------------------------------------------------------
From the screen print, no compilation is done. Check directory of "target", no class file generated.
Why this? I hope that when I have standard folder structure of src/main/java, then maven should automatically try to find the .java file and compile it into target/ folder right?
Did I miss anything?
java maven compilation pom.xml target
add a comment |
up vote
-1
down vote
favorite
[I got it, the tag should be modified to "jar". Fixed!]
I've tried this on both ubuntu and mac, doesn't work. I've Apache Maven 3.5.2 and jdk 1.8
(1) create a directory called mytest and enter:
mkdir mytest
cd mytest
(2) create folder structure of src/main/java
mkdir -p src/main/java
(3) create pom file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.mytest</groupId>
<artifactId>mytest</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
</project>
and a java file of "./src/main/java/m.java"
public class m
public static void main(String args)
System.out.println("hw");
(4) Now the structure is like:
.
./src
./src/main
./src/main/java
./src/main/java/m.java
./pom.xml
(5) mvn clean compile:
$ mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mytest 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ mytest ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.271 s
[INFO] Finished at: 2018-11-10T01:19:27-08:00
[INFO] Final Memory: 7M/188M
[INFO] ------------------------------------------------------------------------
From the screen print, no compilation is done. Check directory of "target", no class file generated.
Why this? I hope that when I have standard folder structure of src/main/java, then maven should automatically try to find the .java file and compile it into target/ folder right?
Did I miss anything?
java maven compilation pom.xml target
1
I got it, the <package> tag should be modified to "jar". Fixed!
– Troskyvs
Nov 10 at 10:06
Ah ..sorry you can simply omit the package tag ...the default isjar
...
– khmarbaise
Nov 10 at 10:15
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
[I got it, the tag should be modified to "jar". Fixed!]
I've tried this on both ubuntu and mac, doesn't work. I've Apache Maven 3.5.2 and jdk 1.8
(1) create a directory called mytest and enter:
mkdir mytest
cd mytest
(2) create folder structure of src/main/java
mkdir -p src/main/java
(3) create pom file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.mytest</groupId>
<artifactId>mytest</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
</project>
and a java file of "./src/main/java/m.java"
public class m
public static void main(String args)
System.out.println("hw");
(4) Now the structure is like:
.
./src
./src/main
./src/main/java
./src/main/java/m.java
./pom.xml
(5) mvn clean compile:
$ mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mytest 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ mytest ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.271 s
[INFO] Finished at: 2018-11-10T01:19:27-08:00
[INFO] Final Memory: 7M/188M
[INFO] ------------------------------------------------------------------------
From the screen print, no compilation is done. Check directory of "target", no class file generated.
Why this? I hope that when I have standard folder structure of src/main/java, then maven should automatically try to find the .java file and compile it into target/ folder right?
Did I miss anything?
java maven compilation pom.xml target
[I got it, the tag should be modified to "jar". Fixed!]
I've tried this on both ubuntu and mac, doesn't work. I've Apache Maven 3.5.2 and jdk 1.8
(1) create a directory called mytest and enter:
mkdir mytest
cd mytest
(2) create folder structure of src/main/java
mkdir -p src/main/java
(3) create pom file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.mytest</groupId>
<artifactId>mytest</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
</project>
and a java file of "./src/main/java/m.java"
public class m
public static void main(String args)
System.out.println("hw");
(4) Now the structure is like:
.
./src
./src/main
./src/main/java
./src/main/java/m.java
./pom.xml
(5) mvn clean compile:
$ mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mytest 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ mytest ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.271 s
[INFO] Finished at: 2018-11-10T01:19:27-08:00
[INFO] Final Memory: 7M/188M
[INFO] ------------------------------------------------------------------------
From the screen print, no compilation is done. Check directory of "target", no class file generated.
Why this? I hope that when I have standard folder structure of src/main/java, then maven should automatically try to find the .java file and compile it into target/ folder right?
Did I miss anything?
java maven compilation pom.xml target
java maven compilation pom.xml target
edited Nov 10 at 10:07
asked Nov 10 at 9:22
Troskyvs
2,23111026
2,23111026
1
I got it, the <package> tag should be modified to "jar". Fixed!
– Troskyvs
Nov 10 at 10:06
Ah ..sorry you can simply omit the package tag ...the default isjar
...
– khmarbaise
Nov 10 at 10:15
add a comment |
1
I got it, the <package> tag should be modified to "jar". Fixed!
– Troskyvs
Nov 10 at 10:06
Ah ..sorry you can simply omit the package tag ...the default isjar
...
– khmarbaise
Nov 10 at 10:15
1
1
I got it, the <package> tag should be modified to "jar". Fixed!
– Troskyvs
Nov 10 at 10:06
I got it, the <package> tag should be modified to "jar". Fixed!
– Troskyvs
Nov 10 at 10:06
Ah ..sorry you can simply omit the package tag ...the default is
jar
...– khmarbaise
Nov 10 at 10:15
Ah ..sorry you can simply omit the package tag ...the default is
jar
...– khmarbaise
Nov 10 at 10:15
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237582%2fsolved-maven-new-project-doesnt-get-java-files-build-why%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I got it, the <package> tag should be modified to "jar". Fixed!
– Troskyvs
Nov 10 at 10:06
Ah ..sorry you can simply omit the package tag ...the default is
jar
...– khmarbaise
Nov 10 at 10:15