2017-03-01 12 views
6

मेरे पास एक गेट रेपो से फोर्क और क्लोन किया गया है मेरी ग्रहण यह जावा 8. पर निर्माण पहली बात मैं है एकमेवेन बिल्ड संकलन त्रुटि: लक्ष्य org.apache.maven.plugins निष्पादित करने में विफल: maven-compiler-plugin: 3.1: प्रोजेक्ट मेवेन पर संकलित (डिफ़ॉल्ट-संकलन)

mvn clean install 

लेकिन मैं निम्नलिखित मिल विफलता संदेश प्रदर्शन है:

[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Maven --- 
[INFO] Deleting /Users/vshukla/git/Prism/target 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Maven --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory /Users/vshukla/git/Prism/src/main/resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Maven --- 
[INFO] Changes detected - recompiling the module! 
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! 
[INFO] Compiling 66 source files to /Users/vshukla/git/Prism/target/classes 
[INFO] ------------------------------------------------------------- 
[ERROR] COMPILATION ERROR : 
[INFO] ------------------------------------------------------------- 
[ERROR] /Users/vshukla/git/Prism/src/main/java/PrenPost/scanUtility.java:[54,52] diamond operator is not supported in -source 1.5 
    (use -source 7 or higher to enable diamond operator) 
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/AppUtility.java:[87,86] diamond operator is not supported in -source 1.5 
    (use -source 7 or higher to enable diamond operator) 
[ERROR] /Users/vshukla/git/Prism/src/main/java/PrenPost/ComparisionUtility.java:[58,52] diamond operator is not supported in -source 1.5 
    (use -source 7 or higher to enable diamond operator) 
[INFO] 3 errors 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1.266 s 
[INFO] Finished at: 2017-03-01T12:11:27+05:30 
[INFO] Final Memory: 13M/309M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Maven: Compilation failure: Compilation failure: 
[ERROR] /Users/vshukla/git/Prism/src/main/java/PrenPost/scanUtility.java:[54,52] diamond operator is not supported in -source 1.5 
[ERROR] (use -source 7 or higher to enable diamond operator) 
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/AppUtility.java:[87,86] diamond operator is not supported in -source 1.5 
[ERROR] (use -source 7 or higher to enable diamond operator) 
[ERROR] /Users/vshukla/git/Prism/src/main/java/PrenPost/ComparisionUtility.java:[58,52] diamond operator is not supported in -source 1.5 
[ERROR] (use -source 7 or higher to enable diamond operator) 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 

हालांकि, नीचे परियोजना स्पष्ट रूप से है जो की निर्माण पथ विवरण है JRE - 8 की स्थापना: build path

और संकलन की स्थापना:

Compliance level

कोई फर्क नहीं पड़ता कि मैं प्रोजेक्ट कितनी बार बनाता हूं, मुझे एक ही त्रुटि मिलती है। परियोजना की सफाई करने और ग्रहण से इसे ताज़ा करने के बाद भी मदद नहीं करता है। कृपया गाइड करें।

अद्यतन:

गुण जोड़ने Maven संकलक प्लगइन

<properties> 
<maven.compiler.source>1.8</maven.compiler.source> 
<maven.compiler.target>1.8</maven.compiler.target> 
</properties> 

स्थापित करने के लिए करने के बाद,

हूँ नीचे त्रुटि हो रही है:

[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Maven --- 
[INFO] Deleting /Users/vshukla/git/Prism/target 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Maven --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory /Users/vshukla/git/Prism/src/main/resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Maven --- 
[INFO] Changes detected - recompiling the module! 
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! 
[INFO] Compiling 66 source files to /Users/vshukla/git/Prism/target/classes 
[INFO] ------------------------------------------------------------- 
[WARNING] COMPILATION WARNING : 
[INFO] ------------------------------------------------------------- 
[WARNING] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java: /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java uses or overrides a deprecated API. 
[WARNING] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java: Recompile with -Xlint:deprecation for details. 
[WARNING] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java: Some input files use unchecked or unsafe operations. 
[WARNING] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java: Recompile with -Xlint:unchecked for details. 
[INFO] 4 warnings 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------- 
[ERROR] COMPILATION ERROR : 
[INFO] ------------------------------------------------------------- 
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java:[26,22] package com.apple.eawt does not exist 
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java:[93,41] cannot find symbol 
    symbol: class Application 
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java:[93,67] cannot find symbol 
    symbol: variable Application 
[INFO] 3 errors 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 2.591 s 
[INFO] Finished at: 2017-03-01T13:09:47+05:30 
[INFO] Final Memory: 21M/347M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Maven: Compilation failure: Compilation failure: 
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java:[26,22] package com.apple.eawt does not exist 
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java:[93,41] cannot find symbol 
[ERROR] symbol: class Application 
[ERROR] /Users/vshukla/git/Prism/src/main/java/main/MainUITabbed.java:[93,67] cannot find symbol 
[ERROR] symbol: variable Application 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 

और यहाँ है कोड स्निपेट कंपी दे रहा है मेनयूआईटीएबेड क्लास से लेशन त्रुटि:

import com.apple.eawt.Application; 
public static void main(String[] args) { 
    EventQueue.invokeLater(new Runnable() { 
     public void run() { 
      try { 


       Application application = Application.getApplication(); // line 93 

       ImageIcon imgicon = new ImageIcon(getClass().getResource(
         "ICON.jpg")); 
       Image img = imgicon.getImage(); 


       application.setDockIconImage(img); 

       MainUITabbed frame = new MainUITabbed(); 
       frame.setVisible(true); 
      } catch (Exception e) { 
       e.printStackTrace(); 

      } 
     } 
    }); 
} 
+2

क्या आपके पास निर्भरता है:,210 ' com.apple AppleJavaExtensions 1,4 ' अपने pom.xml में? – DrHopfen

+0

नहीं। मुझे कोशिश करने दो। –

+0

शानदार। इसने काम कर दिया। पर कैसे? वह त्रुटि क्यों थी? –

उत्तर

4

मुझे नहीं लगता कि आईडीई यहां प्रासंगिक है। आखिरकार आप एक मेवेन चला रहे हैं और मेवेन में कोई स्रोत नहीं है जो हीरा ऑपरेटरों को संकलित करने की अनुमति देगा। तो, मुझे लगता है कि आप Maven-संकलक प्लगइन ही विन्यास चाहिए

आप के बारे में पढ़ सकते हैं इस here

लेकिन निम्नलिखित गुण जोड़ने के लिए सामान्य कोशिश में:

<properties> 
<maven.compiler.source>1.8</maven.compiler.source> 
<maven.compiler.target>1.8</maven.compiler.target> 
</properties> 

और देखें कि क्या यह संकलित अब Maven में केवल

आशा इस

+0

है कृपया संपादन देखें। –

17

पोम को यह जोड़ा जा रहा है के लिए यह तय करने में मदद करता आर मुझे कृपया संस्करण में समायोजित करें

... 
</dependencies> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.5.1</version> 
      <configuration> 
       <source>1.8</source> 
       <target>1.8</target> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 
+0

कृपया संपादन देखें। –

1

मेरे मामले में की जरूरत है, यह OpenJDK 9 के साथ एक असंगति (जो मैं जांच नहीं की) से कारण होता था।

आप JDK 9, की जरूरत नहीं है एक अस्थायी काम के आसपास अपने मशीन से यह शुद्ध करने के लिए किया जाएगा:

sudo apt-get remove --purge openjdk-9-jdk openjdk-9-jre 
sudo apt-get remove --purge openjdk-9-jdk-headless openjdk-9-jre-headless 
0

मैं एक ही समस्या थी और मैं इस

<configuration> 
    <source>1.7</source> 
    <target>1.7</target> 
</configuration> 

बदली गई यहां 1.7 मेरा जेडीके संस्करण है। इसे हल किया गया था।

1

बडी,
इस अप-टू-डेट है हर हैं, तब भी आप इस समस्या हो रही है, तो
टर्मिनल से यह आदेश चलाकर कोशिश के बजाय सीधे ग्रहण से चल रहा है।
$ mvn clean install

और सुनिश्चित करें कि इन बातों:

  • Maven सिस्टम पथ में है
  • सभी Maven निर्भरता पर avaialble हैं `.m2/repository`
  • जावा सिस्टम पथ में है


संबंधित मुद्दे